-
Notifications
You must be signed in to change notification settings - Fork 3
131 lines (115 loc) · 3.47 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build and publish wheels
on:
workflow_dispatch:
inputs:
package:
required: true
type: string
version:
required: true
type: string
python_version:
required: true
type: string
strategy:
required: true
type: string
workflow_call:
inputs:
package:
required: true
type: string
version:
required: true
type: string
python_version:
required: true
type: string
strategy:
required: true
type: string
permissions:
contents: read
pages: write
id-token: write
jobs:
validate-args:
runs-on: ubuntu-latest
steps:
- name: Print input arguments
run: echo "${{ toJSON(github.event.inputs) }}"
- uses: mukunku/[email protected]
id: check-tag
with:
tag: ${{ inputs.package }}-${{ inputs.version }}-cpython${{ inputs.python_version }}
- uses: nick-fields/assert-action@v1
with:
expected: "false"
actual: "${{ steps.check-tag.outputs.exists }}"
comparison: exact
build_dockerfile:
needs: validate-args
if: ${{ inputs.strategy == 'dockerfile' }}
uses: ./.github/workflows/build_wheel_dockerfile.yml
with:
package: ${{ inputs.package }}
version: ${{ inputs.version }}
python_version: ${{ inputs.python_version }}
build_pypi:
needs: validate-args
if: ${{ inputs.strategy == 'pypi' }}
uses: ./.github/workflows/build_wheel_pypi.yml
with:
package: ${{ inputs.package }}
version: ${{ inputs.version }}
python_version: ${{ inputs.python_version }}
release:
needs: [build_dockerfile, build_pypi]
if: ${{ always() }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ inputs.package }}-${{ inputs.version}}-cpython${{ inputs.python_version }}
path: /tmp/wheelhouse/
- name: Release
uses: softprops/action-gh-release@v1
with:
files: /tmp/wheelhouse/*.whl
tag_name: ${{ inputs.package }}-${{ inputs.version }}-cpython${{ inputs.python_version }}
body: ${{ inputs.package }} ${{ inputs.version }}
update-pypi:
needs: release
if: ${{ always() }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Pull latest
run: |
git pull
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.9'
- name: Install Python dependencies
run: |
pip install requests beautifulsoup4
- name: Update PyPI
run: python ./scripts/generate_pypi_links.py ${{ inputs.package }}-${{ inputs.version }}-cpython${{ inputs.python_version }} ${{ inputs.package }}
- name: Commit and push
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_user_name: "github-actions[bot]"
commit_user_email: "github-actions[bot]@users.noreply.github.com"
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
commit_message: Update PyPI for ${{ inputs.package }}-${{ inputs.version }}-cpython${{ inputs.python_version }}
publish-pypi:
needs: update-pypi
if: ${{ always() }}
uses: ./.github/workflows/pages.yml