Skip to content
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

feat: Check git tag matches version on release #115

Merged
merged 2 commits into from
Apr 3, 2023
Merged
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
12 changes: 9 additions & 3 deletions .github/workflows/tagged_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: fountainhead/[email protected]
id: wait-for-test
with:
token: ${{ secrets.PA_TOKEN }}
token: ${{ secrets.GH_DEPLOY_TOKEN }}
checkName: CI
ref: ${{ github.sha }}

Expand All @@ -37,12 +37,18 @@ jobs:
run: poetry build

- name: Set prerelease variable
run: echo "IS_PRERELEASE=$(if $(poetry version -s | grep -qP '^v[0-9]+\.[0-9]+\.[0-9]+$'); then echo 'false'; else echo 'true'; fi)" >> $GITHUB_ENV
run: echo "IS_PRERELEASE=$(if $(poetry version -s | grep -qP '^[0-9]+\.[0-9]+\.[0-9]+$'); then echo 'false'; else echo 'true'; fi)" >> $GITHUB_ENV

- name: Set release git tag
run: echo "RELEASE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV

- name: Check tag matches package version
run: if [[ "$(poetry version -s)" == ${RELEASE_TAG/v/} ]]; then exit 0; else exit 1; fi

- name: Release new tag
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ fromJSON(env.IS_PRERELEASE) }}
token: ${{ secrets.PA_TOKEN }}
token: ${{ secrets.GH_DEPLOY_TOKEN }}
files: |
dist/*