Skip to content

Commit

Permalink
rework the flow of actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Calychas committed Nov 22, 2023
1 parent 623a2f3 commit a1d077b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
name: "Build & publish - DEV"
on:
push:
branches:
- main
workflow_run:
workflows: [Test - DEV]
types:
- completed

jobs:
run-tests:
name: "Run tests job"
uses: ./.github/workflows/_tests.yml

build-n-publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
needs: [run-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -45,8 +42,8 @@ jobs:
run: pdm publish --repository testpypi --username __token__ --password ${{ secrets.PYPI_TEST_API_TOKEN }} --comment ${{ github.sha }} --verbose

generate-docs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Generate latest library 📚 documentation 📄
needs: [run-tests]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/gh-release.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
name: "GitHub release"
on:
push:
branches:
- main
workflow_run:
workflows: [Test - DEV]
types:
- completed

jobs:
run-tests:
name: "Run tests job"
uses: ./.github/workflows/_tests.yml

github-release:
if: ${{ contains(github.event.head_commit.message, format('chore(CI/CD){0} bump version', ':')) }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Create a GitHub release
needs: [run-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.CICD_PAT_TOKEN }}
- name: Get last commit message
id: get-last-commit-message
run: echo COMMIT_MESSAGE="$(git log -1 --pretty=%B | cat)" >> "$GITHUB_OUTPUT"
- name: Check commit message for release info
run: ${{ contains(steps.get-last-commit-message.outputs.COMMIT_MESSAGE, format('chore(CI/CD){0} bump version', ':')) }}
- name: Configure Git user
run: |
git config --local user.name "Kraina CI/CD"
Expand All @@ -30,7 +31,7 @@ jobs:
id: extract-version
uses: winterjung/split@v2
with:
msg: ${{ github.event.head_commit.message }}
msg: ${{ steps.get-last-commit-message.outputs.COMMIT_MESSAGE }}
- name: Release
uses: softprops/action-gh-release@v1
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Test - DEV"
on:
push:
branches:
- main

jobs:
run-tests:
name: "Run tests job"
uses: ./.github/workflows/_tests.yml

0 comments on commit a1d077b

Please sign in to comment.