-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
177 lines (156 loc) · 5.11 KB
/
action.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: ozi-release
description: "OZI release draft action."
inputs:
python-dist:
description: "python dist version string e.g. security1, security2, bugfix, prerelease"
required: true
github-token:
description: "GitHub workflow-generated token"
required: true
tag:
description: "release tag name"
required: true
outputs:
hashes:
description: "release file hashes for provenance"
value: ${{ steps.hash.outputs.hashes }}
runs:
using: "composite"
steps:
- name: Get OZI specification API
id: api
run: |
echo "python-version=$( curl -L https://oziproject.dev/api.json | jq -c '.spec.python.support.${{ inputs.python-dist }}' )" >> $GITHUB_OUTPUT
echo "ozi-build=$( curl -L https://oziproject.dev/api.json | jq -c '.spec.python.build.requires."OZI.build"' )" >> $GITHUB_OUTPUT
echo "tox=$( curl -L https://oziproject.dev/api.json | jq -c '.spec.python.ci.backend.tox' )" >> $GITHUB_OUTPUT
echo "tox-gh=$( curl -L https://oziproject.dev/api.json | jq -c '.spec.python.ci.backend."tox-gh"' )" >> $GITHUB_OUTPUT
shell: bash
- name: Get Python tag
id: cibuildwheel-support
run: |
echo "tag=$( echo ${{ steps.api.outputs.python-version }} | sed 's/\.//' )" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806
with:
name: ${{ inputs.python-dist }}
- name: Set up Python ${{ steps.api.outputs.python-version }}
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38
with:
cache: 'pip'
python-version: ${{ fromJSON(steps.api.outputs.python-version) }}
allow-prereleases: true
check-latest: true
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --user -r ${GITHUB_ACTION_PATH}/requirements.txt
pipx ensurepath --force
pipx install meson --force
shell: bash
- name: Configure git repository
if: inputs.python-dist == 'security2'
run: |
git config --global user.email "noreply@oziproject.dev"
git config --global user.name "OZI Packaging"
rm -rf .git/COMMIT_EDITMSG
shell: bash
- name: Hiding README.rst symlink from SCM
continue-on-error: true
run: |
git update-index --skip-worktree README.rst
shell: bash
- name: Hiding README.md symlink from SCM
continue-on-error: true
run: |
git update-index --skip-worktree README.md
shell: bash
- name: Hiding README.txt symlink from SCM
continue-on-error: true
run: |
git update-index --skip-worktree README.txt
shell: bash
- name: Hiding subprojects/ozi
continue-on-error: true
run: |
git update-index --skip-worktree subprojects/ozi
shell: bash
- name: git diff
run: git diff
shell: bash
- name: Build and sign wheel
if: contains(fromJSON('["prerelease", "security1", "security2"]'), inputs.python-dist)
run: |
tox -e invoke -- release
shell: bash
- name: git diff
run: git diff
shell: bash
- name: Build and sign sdist then wheel
if: inputs.python-dist == 'bugfix'
id: sdist
run: |
tox -e invoke -- release --sdist
shell: bash
- uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46
if: inputs.python-dist == 'bugfix'
with:
inputs: |
dist/${{ github.event.repository.name }}-${{ inputs.tag }}.tar.gz
dist/*.whl
release-signing-artifacts: true
upload-signing-artifacts: true
- name: Move wheel signing files
if: inputs.python-dist == 'prerelease'
run: |
mkdir sig
mv dist/*.whl.sigstore.json sig
mv dist/*.tar.gz.sigstore.json sig
rm -rf dist/*.dist-info
shell: bash
- name: Generate hashes for provenance
shell: bash
id: hash
if: inputs.python-dist == 'prerelease'
run: |
# sha256sum generates sha256 hash for all artifacts.
# base64 -w0 encodes to base64 and outputs on a single line.
# sha256sum artifact1 artifact2 ... | base64 -w0
echo "hashes=$(sha256sum ./dist/* | base64 -w0)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
if: inputs.python-dist == 'security2'
with:
include-hidden-files: true
name: 'security1'
path: |
!*-checkpoint/
!.git/config
!signing-artifacts-*/
!security2/
!build/
./
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
if: inputs.python-dist == 'security1'
with:
include-hidden-files: true
name: 'bugfix'
path: |
!security1/
!build/
./
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
if: inputs.python-dist == 'bugfix'
with:
include-hidden-files: true
name: 'prerelease'
path: |
!bugfix/
!build/
./
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
if: inputs.python-dist == 'prerelease'
with:
include-hidden-files: true
path: |
!prerelease/
!build/
./