Joss paper submission (#28) #39
This file contains 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
# Automatically creates a new tag and GitHub release if poetry version doesn't match last release version | |
name: Release | |
on: | |
workflow_dispatch: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Checkout branch "main" | |
uses: actions/checkout@v3 | |
with: | |
ref: 'main' | |
fetch-depth: 0 | |
- name: Install Global Dependencies | |
run: pip install -U pip && pip install poetry wheel | |
- name: Build project for distribution | |
run: poetry build | |
- name: Get Current Version | |
id: get_version | |
run: | | |
TAG_NAME=$(poetry version -s) | |
echo "TAG_NAME=v$TAG_NAME" >> $GITHUB_ENV | |
echo "$TAG_NAME" | |
- name: Check Released Versions | |
id: get_last_release_version | |
run: | | |
LAST_RELEASE=$(git tag --sort=committerdate | tail -1) | |
echo "LAST_RELEASE_VERSION=$LAST_RELEASE" >> $GITHUB_ENV | |
echo "Last released tag: $LAST_RELEASE" | |
- name: Check for Version Mismatch | |
shell: bash | |
if: ${{ env.LAST_RELEASE_VERSION != env.TAG_NAME }} | |
run: | | |
echo "New version found. Matching release will be created." | |
echo "Last version: ${{ env.LAST_RELEASE_VERSION }}" | |
echo "Current version: ${{ env.TAG_NAME }}" | |
- name: Tag and Release GitHub Snapshot | |
id: release-snapshot | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit: main | |
tag: ${{ env.TAG_NAME }} | |
skipIfReleaseExists: true | |
draft: false | |
prerelease: false | |
- name: Publish to PyPI | |
if: steps.release_snapshot.outcome == 'success' | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PII_CODEX_PYPI_TOKEN }} | |
run: poetry publish |