-
Notifications
You must be signed in to change notification settings - Fork 2
96 lines (81 loc) · 2.29 KB
/
build_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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Build and Release
on:
create:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
env:
PACKAGE_NAME: rydiqule
jobs:
build:
name: Build
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Build Tools
run: |
python -m pip install --upgrade pip setuptools wheel build
- name: Build Source Distribution
run: |
python -m build -s .
- name: Build Wheel Distribution
run: |
python -m build -w .
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: ./dist
github-release:
name: Github Release
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
needs: [build]
permissions:
packages: read
contents: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: dist
path: ./dist
- name: Get Version Number
run: |
VERSION="${GITHUB_REF/refs\/tags\/v/}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create Github Release and Upload Release Asset
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.ref }}
name: ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
draft: true
prerelease: ${{ contains(github.event.ref, 'rc') }}
files: ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
release:
name: PyPI Release
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
needs: [build]
environment:
name: pypi
url: https://pypi.org/p/${{ env.PACKAGE_NAME }}
permissions:
id-token: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: dist
path: ./dist
- name: Publish on TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1