-
Notifications
You must be signed in to change notification settings - Fork 14
60 lines (51 loc) · 1.72 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Release
on:
push:
branches:
- main
jobs:
call-test-workflow:
uses: BlueBrain/BlueCelluLab/.github/workflows/test.yml@main
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build-and-publish:
name: Build, publish on PyPI and make a GitHub release
runs-on: ubuntu-latest
needs: call-test-workflow
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Fetch the tag, if any. If not tagged, create a patch tag
uses: anothrNick/[email protected]
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 --sdist --wheel .
- 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@v2
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 }}