|
| 1 | +name: "Run CD" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +env: |
| 7 | + # disable keyring (https://github.com/actions/runner-images/issues/6185): |
| 8 | + PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring |
| 9 | + |
| 10 | +jobs: |
| 11 | + # To be enabled when we add docs |
| 12 | + # docs: |
| 13 | + # permissions: |
| 14 | + # contents: write |
| 15 | + # runs-on: ubuntu-latest |
| 16 | + # steps: |
| 17 | + # - uses: actions/checkout@v4 |
| 18 | + # - uses: ./.github/actions/setup-poetry |
| 19 | + # - name: Build and push docs |
| 20 | + # run: poetry run mkdocs gh-deploy --force |
| 21 | + |
| 22 | + code-checks: |
| 23 | + uses: ./.github/workflows/checks.yml |
| 24 | + pre-release-check: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + outputs: |
| 27 | + TARGET_TAG_V: ${{ steps.version_check.outputs.TRGT_VERSION }} |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + fetch-depth: 0 # for fetching tags, required for semantic-release |
| 32 | + - uses: ./.github/actions/setup-poetry |
| 33 | + - name: Check version of potential release |
| 34 | + id: version_check |
| 35 | + run: | |
| 36 | + TRGT_VERSION=$(poetry run semantic-release print-version) |
| 37 | + echo "TRGT_VERSION=${TRGT_VERSION}" >> $GITHUB_OUTPUT |
| 38 | + echo "${TRGT_VERSION}" |
| 39 | + - name: Check notes of potential release |
| 40 | + run: poetry run semantic-release changelog --unreleased |
| 41 | + release: |
| 42 | + needs: [code-checks, pre-release-check] |
| 43 | + if: needs.pre-release-check.outputs.TARGET_TAG_V != '' |
| 44 | + environment: auto-release |
| 45 | + runs-on: ubuntu-latest |
| 46 | + concurrency: release |
| 47 | + steps: |
| 48 | + - uses: actions/create-github-app-token@v1 |
| 49 | + id: app-token |
| 50 | + with: |
| 51 | + app-id: ${{ vars.CI_APP_ID }} |
| 52 | + private-key: ${{ secrets.CI_PRIVATE_KEY }} |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + with: |
| 55 | + token: ${{ steps.app-token.outputs.token }} |
| 56 | + fetch-depth: 0 # for fetching tags, required for semantic-release |
| 57 | + - uses: ./.github/actions/setup-poetry |
| 58 | + - name: Run release script |
| 59 | + env: |
| 60 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 61 | + TARGET_VERSION: ${{ needs.pre-release-check.outputs.TARGET_TAG_V }} |
| 62 | + CHGLOG_FILE: CHANGELOG.md |
| 63 | + run: ./.github/scripts/release.sh |
| 64 | + shell: bash |
0 commit comments