Skip to content

Preparation for alpha package 2.0.0a7 (#309) #10

Preparation for alpha package 2.0.0a7 (#309)

Preparation for alpha package 2.0.0a7 (#309) #10

Workflow file for this run

name: Publish package
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # normal release
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+" # release candidate
- "v[0-9]+.[0-9]+.[0-9]+[ab][0-9]+" # alpha or beta release
jobs:
build:
uses: ./.github/workflows/build.yml
upload:
name: Upload
runs-on: ubuntu-latest
needs: build
outputs:
DO_GITHUB_RELEASE: ${{ steps.detect-release.outputs.DO_GITHUB_RELEASE }}
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: distributions
path: dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Detect release version
id: detect-release
run: |
do_github_release=$((echo "${GITHUB_REF}" | grep -Eq "^refs\/tags\/v[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?$") && echo 1 || echo 0)
echo DO_GITHUB_RELEASE=$do_github_release >> $GITHUB_OUTPUT
echo DO_GITHUB_RELEASE=$do_github_release
release:
name: Release
runs-on: ubuntu-latest
needs: upload
if: needs.upload.outputs.DO_GITHUB_RELEASE == '1'
permissions:
contents: write
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Download Build
uses: actions/download-artifact@v3
with:
name: distributions
path: dist
- name: Download unittest reports
uses: actions/download-artifact@v3
with:
name: unittest_reports
path: pytest_reports/
- name: Zip unittest reports
uses: vimtor/[email protected]
with:
files: pytest_reports/
dest: pytest_reports/test_reports.zip
- name: Detect prerelease
id: detect-prerelease
run: |
do_prerelease=$((echo "${GITHUB_REF}" | grep -Eq "^refs\/tags\/v[0-9]+\.[0-9]+\.[0-9]+rc[0-9]+$") && echo 1 || echo 0)
echo DO_PRERELEASE=$do_prerelease >> $GITHUB_ENV
echo DO_PRERELEASE=$do_prerelease
- name: Attach artifacts to github release
uses: softprops/action-gh-release@v1
with:
files: |
CHANGELOG.md
dist/*
pytest_reports/test_reports.zip
prerelease: ${{ env.DO_PRERELEASE == '1' }}
body_path: CHANGELOG.md