Skip to content

Add release publish action #1

Add release publish action

Add release publish action #1

name: Publish release
on:
release:
types: [created]
env:
IS_TEST: true
jobs:
generate_info:

Check failure on line 11 in .github/workflows/publish_release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish_release.yml

Invalid workflow file

You have an error in your yaml syntax on line 11
name: Generate info
environment: release
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Parse version tag
id: parse_version_tag
env:
TAG_NAME: ${{ github.event.release.tag_name }}
run: |
tag_name="${{ env.TAG_NAME }}"
if [[ ! "${tag_name}" =~ ^v.+$ ]]; then
echo "::error::Tag name must start with 'v'"
exit 1
fi
pypi_output="pypi-version=${tag_name#v}"
echo "${pypi_output}" >> $GITHUB_OUTPUT
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: pip install build twine
- name: Update package version
run: |
echo "VERSION = \"${{ needs.generate_info.outputs.pypi-version }}\"" > ergate/__version__.py
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .
- name: Publish package distribution
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: ${{ env.IS_TEST == 'true' && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}