fix(ci): one more syntax fix, do not use .env in job conditionals #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | ||
|
Check failure on line 1 in .github/workflows/release.yml
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["Lint and test"] | ||
| types: | ||
| - completed | ||
| branches: | ||
| - master | ||
| - 'ci/**' # ci testing, pre-releases | ||
| #- develop # can emit -dev releases but we do not want to | ||
| workflow_dispatch: | ||
| inputs: | ||
| dry_run: | ||
| description: "Run in dry-run mode (no publish)" | ||
| required: false | ||
| default: "true" | ||
| # MUSTHAVE: Trusted publisher access for both repos. | ||
| # NOTE: according to docs, 'test' repo accounts are ephemeral and can be wiped at any time | ||
| env: | ||
| DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }} | ||
| pypi_main_repo: https://upload.pypi.org/legacy/ | ||
| pypi_test_repo: https://test.pypi.org/legacy/ | ||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'master' || startsWith(github.event.workflow_run.head_branch, 'ci/') ) ) | ||
| permissions: | ||
| contents: write | ||
| issues: write | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: ./.github/actions/setup-semantic-release # node+semantic-release | ||
| - uses: ./.github/actions/setup # poetry | ||
| - id: semantic-release # branch policies defined in .releaserc | ||
| env: | ||
| GIT_AUTHOR_NAME: appland-release | ||
| GIT_AUTHOR_EMAIL: release@app.land | ||
| GIT_COMMITTER_NAME: appland-release | ||
| GIT_COMMITTER_EMAIL: release@app.land | ||
| run: | | ||
| if [ "$DRY_RUN" = "true" ]; then | ||
| semantic-release --dry-run | ||
| else | ||
| semantic-release | ||
| fi | ||
| - name: Upload wheel | ||
| if: env.DRY_RUN != 'true' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: wheel | ||
| path: dist/*.whl | ||
| - name: Upload sdist | ||
| if: env.DRY_RUN != 'true' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: sdist | ||
| path: dist/*.tar.gz | ||
| outputs: # not reused in fact | ||
| release_tag: ${{ steps.semantic-release.outputs.next_release_tag }} | ||
| smoketest: | ||
| runs-on: ubuntu-latest | ||
| needs: release | ||
| if: github.event.inputs.dry_run!='true' | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: ./.github/actions/refetch-artifacts | ||
| - name: dockerhub login (for seamless docker pulling) | ||
| uses: ./.github/actions/dockerhub-login | ||
| env: | ||
| DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
| DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }} | ||
| continue-on-error: true | ||
| - run: ci/run_tests.sh | ||
| env: | ||
| SMOKETEST_DOCKER_IMAGE: python:3.12-alpine | ||
| pypi: | ||
| name: upload release to PyPI | ||
| needs: ['release','smoketest'] | ||
| if: (( github.event.inputs.dry_run != 'true' ) && ((github.ref_name == 'master') || startsWith(github.ref_name,"ci/"))) | ||
| runs-on: ubuntu-latest | ||
| environment: pypi | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: ./.github/actions/refetch-artifacts | ||
| - name: Publish package distributions to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| repository-url: ${{ github.ref_name == 'master' && env.pypi_main_repo || env.pypi_test_repo }} | ||