Merge pull request #270 from AurelienJaquier/pyproject #23
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: Build | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
call-test-workflow: | |
uses: BlueBrain/BluePyMM/.github/workflows/test.yml@master | |
build-tag-n-publish: | |
name: Build, tag and publish on PyPI | |
runs-on: ubuntu-latest | |
needs: call-test-workflow | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Bump version and push tag | |
uses: anothrNick/github-tag-action@1.64.0 | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
id: tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: false | |
DEFAULT_BUMP: patch | |
- name: Build a source tarball and wheel | |
run: | | |
pip install build | |
python -m build | |
- name: Get and store tag from 'Bump version and push tag' step | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
run: echo "TAG_NAME=${{ steps.tag.outputs.new_tag }}" >> $GITHUB_ENV | |
- name: Get and store tag from triggered tag push | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
name: ${{ env.TAG_NAME }} | |
generate_release_notes: true | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} |