Skip to content

run test suite instead of reading most recent run on release #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

- Reworded two headers in the template README to better reflect their purpose.
- When cutting a release via `release.yml` GitHub Action workflow, run test suite before publishing package to PyPI. Previously the CLI tools `gh` and `jq` were used to check the most recent run of the test suite.

### Removed

Expand Down
32 changes: 5 additions & 27 deletions src/django_twc_package/.github/workflows/release.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,12 @@ on:
release:
types: [released]

jobs:
check:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
env:
GH_TOKEN: ${% raw %}{{ secrets.GITHUB_TOKEN }}{% endraw %}
steps:
- uses: actions/checkout@v4

- name: Check most recent test run on `main`
id: latest-test-result
run: |
echo "result=$(gh run list \
--branch=main \
--workflow=test.yml \
--json headBranch,workflowName,conclusion \
--jq '.[] | select(.headBranch=="main" and .conclusion=="success") | .conclusion' \
| head -n 1)" >> $GITHUB_OUTPUT
permissions:
contents: write

- name: OK
if: ${% raw %}{{ (contains(steps.latest-test-result.outputs.result, 'success')) }}{% endraw %}
run: exit 0

- name: Fail
if: ${% raw %}{{ !contains(steps.latest-test-result.outputs.result, 'success') }}{% endraw %}
run: exit 1
jobs:
test:
uses: ./.github/workflows/test.yml

pypi:
if: ${% raw %}{{ github.event_name == 'release' }}{% endraw %}
Expand Down