-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (80 loc) · 2.48 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
69
70
71
72
73
74
75
76
77
78
79
80
name: Release New Version
on:
push:
branches:
- main
env:
REPOSITORY_NAME: action-demo
jobs:
create-release:
name: Create a new release
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.7"
- name: Retrieve Release Version
id: version
run: echo "VERSION=$(python3 setup.py --version)" >> "$GITHUB_ENV"
- name: "✏️ Generate release changelog"
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
futureRelease: "v${{ env.VERSION }}"
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: "v${{ env.VERSION }}"
name: "Release v${{ env.VERSION }}"
bodyFile: CHANGELOG.md
- name: Install pypa/build
run: python3 -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python3 -m build --sdist --wheel --outdir dist/
- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: linux-dist
path: dist/
publish-library-dev:
name: Publish new release on dev
needs: ['create-release']
permissions: write-all
runs-on: ubuntu-latest
environment:
name: dev
url: "https://test.pypi.org/project/${{ env.REPOSITORY_NAME }}/"
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: linux-dist
path: dist/
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: "https://test.pypi.org/legacy/"
publish-library-prod:
name: Publish new release on prod
needs: ['create-release', 'publish-library-dev']
permissions: write-all
runs-on: ubuntu-latest
environment:
name: prod
url: "https://pypi.org/project/${{ env.REPOSITORY_NAME }}/"
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: linux-dist
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1