Skip to content

Commit

Permalink
[FIX] Have publishing workflow test before publishing (#55)
Browse files Browse the repository at this point in the history
Squash of 6 commits:
* ci: πŸ› οΈ Allow build & release to trigger and wait on tests.

* ci: πŸš€ run on push to allow workflow triggering.

* ci: ♻️ restore push behavior w/tags

* ci: πŸ› Fix if statemetns for workflow_dispatch

* ci: πŸš€ Uncomment publish statement for non-workflow_dispatch runs

* ci: πŸ› οΈ Disallow minting tokens on workflow dispatch.

* chore(README): 🎨 Space in README
  • Loading branch information
teald authored Aug 26, 2024
1 parent be67ece commit 0e0c0cd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
schedule:
- cron: "20 1 * * mon"
workflow_dispatch:
workflow_call:

defaults:
run:
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}'
1 change: 1 addition & 0 deletions .github/workflows/source_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
schedule:
- cron: "20 1 * * mon"
workflow_dispatch:
workflow_call:

defaults:
run:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
=============

Expand Down

0 comments on commit 0e0c0cd

Please sign in to comment.