-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 1.94 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
61
62
63
64
65
66
67
68
name: Release 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:
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
publish:
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: 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: |
dist/*.whl
CHANGELOG.md
prerelease: ${{ env.DO_PRERELEASE == '1' }}
body_path: CHANGELOG.md