diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 028df5c6..99d574d1 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -8,6 +8,7 @@ on: schedule: - cron: "20 1 * * mon" workflow_dispatch: + workflow_call: defaults: run: diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index a7089557..4210c31c 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -5,9 +5,20 @@ on: tags: # Matches any tags; tags are only used for versioning in this project. - '*' + workflow_dispatch: jobs: + source_test: + # This runs the test files on the repository before publishing it. + name: Source tests + uses: ./.github/workflows/source_tests.yml + + build_test: + name: Build tests + uses: ./.github/workflows/build_tests.yml + deploy: + needs: [source_test, build_test] runs-on: ubuntu-latest permissions: @@ -29,15 +40,21 @@ jobs: virtualenvs-create: false - name: Update version (kept at 0.0.0) in pyproject.toml and build + if: ${{ github.event_name != 'workflow_dispatch' }} run: | poetry version ${{ github.ref_name }} poetry version poetry build - name: Mint token + if: ${{ github.event_name != 'workflow_dispatch' }} id: mint uses: tschm/token-mint-action@v1.0.3 - name: Publish the package with poetry + # Allow workflow dispatch to trigger this job, but don't allow it + # to publish the package to PyPI. + if: ${{ github.event_name != 'workflow_dispatch' }} run: | - poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}' + echo "PUBLISHING!!!! ✨🚀" + poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}' diff --git a/.github/workflows/source_tests.yml b/.github/workflows/source_tests.yml index 79e69d31..9601eefe 100644 --- a/.github/workflows/source_tests.yml +++ b/.github/workflows/source_tests.yml @@ -8,6 +8,7 @@ on: schedule: - cron: "20 1 * * mon" workflow_dispatch: + workflow_call: defaults: run: diff --git a/README.md b/README.md index e671382a..ba562d2b 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ [pypi package version badge]: https://badge.fury.io/py/astrodata.svg [source test status badge]: https://github.com/GeminiDRSoftware/astrodata/actions/workflows/source_tests.yml/badge.svg [build test status badge]: https://github.com/GeminiDRSoftware/astrodata/actions/workflows/build_tests.yml/badge.svg + `astrodata` =============