fix: retry is wrong logic here (#121) #35
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
on: | |
push: | |
paths: | |
- "magnus/**" | |
branches: | |
- "main" | |
jobs: | |
PRCheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- run: python -m pip install poetry | |
- run: | | |
python -m poetry install | |
poetry run tox | |
Release: | |
runs-on: ubuntu-latest | |
needs: PRCheck | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- run: python -m pip install python-semantic-release==7.34.6 | |
- name: Figure version | |
id: last_tag | |
run: | | |
VERSION=$(semantic-release print-version --patch) | |
echo $VERSION | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Apply new tag | |
env: | |
VERSION: ${{ steps.last_tag.outputs.version }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const {VERSION} = process.env | |
const tag = `refs/tags/${VERSION}` | |
await github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: tag, | |
sha: context.sha | |
}) | |
- name: Publish to PyPI | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
LAST_TAG: ${{ steps.last_tag.outputs.version }} | |
run: | | |
python -m pip install poetry | |
python scripts/update_version.py $LAST_TAG | |
poetry config pypi-token.pypi $PYPI_TOKEN | |
poetry publish --build | |
- name: "Create release" | |
env: | |
RELEASE_TAG: ${{ steps.last_tag.outputs.version }} | |
uses: "actions/github-script@v6" | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
script: | | |
try { | |
const response = await github.rest.repos.createRelease({ | |
draft: false, | |
generate_release_notes: true, | |
name: process.env.RELEASE_TAG, | |
owner: context.repo.owner, | |
prerelease: false, | |
repo: context.repo.repo, | |
tag_name: process.env.RELEASE_TAG, | |
}); | |
core.exportVariable('RELEASE_ID', response.data.id); | |
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url); | |
} catch (error) { | |
core.setFailed(error.message); | |
} |