Release to PyPI #1
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
name: "Release to PyPI" | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.type }} | ||
cancel-in-progress: true | ||
on: | ||
workflow_run: | ||
workflows: ["build_and_test_slow"] | ||
types: | ||
- completed | ||
workflow_dispatch: | ||
env: | ||
INSTALLDIR: "build-install" | ||
CCACHE_DIR: "${{ github.workspace }}/.ccache" | ||
jobs: | ||
# release is ran when a release is made on Github | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: [build_and_test_slow] | ||
if: startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4.6.1 | ||
with: | ||
python-version: 3.9 | ||
architecture: "x64" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --progress-bar off --upgrade pip | ||
python -m pip install --progress-bar off build twine | ||
- name: Prepare environment | ||
run: | | ||
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | ||
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
- name: Download package distribution files | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: package | ||
path: dist | ||
- name: Publish package to PyPI | ||
run: | | ||
ls dist/* | ||
twine upload -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} dist/* | ||
- name: Publish GitHub release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
# body_path: ${{ github.workspace }}-RELEASE_NOTES.md | ||
prerelease: ${{ contains(env.TAG, 'rc') }} | ||
files: | | ||
dist/* |