Repository navigation
210 lines (184 loc) · 6.52 KB
/
Copy pathrelease.yml
File metadata and controls
210 lines (184 loc) · 6.52 KB
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g. 0.1.0 or v0.1.0 — leading v is stripped automatically)'
required: true
type: string
branch:
description: 'Branch to cut the release from (defaults to main)'
required: false
type: string
default: main
jobs:
validate-branch:
name: Validate release branch
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check branch exists on origin
env:
GH_TOKEN: ${{ github.token }}
BRANCH: ${{ inputs.branch }}
run: |
ENCODED_BRANCH="${BRANCH//\//%2F}"
if ! gh api "repos/${{ github.repository }}/branches/${ENCODED_BRANCH}" --silent 2>/dev/null; then
echo "::error::Branch '${BRANCH}' does not exist. Check for typos."
exit 1
fi
echo "Branch '${BRANCH}' confirmed."
test:
name: Test (Python ${{ matrix.python-version }})
needs: [validate-branch]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: true
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0 # required: hatch-vcs needs full tag history
ref: ${{ inputs.branch }}
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y graphviz libgraphviz-dev
- name: Install dependencies
run: uv sync --locked --all-extras --dev --python ${{ matrix.python-version }}
- name: Run tests
run: uv run --python ${{ matrix.python-version }} pytest -m "not postgres" --tb=short -q
license-check:
needs: [validate-branch]
uses: ./.github/workflows/_license-check.yml
with:
branch: ${{ inputs.branch }}
build:
name: Build distribution
needs: [test, license-check]
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write # required to push the release tag
outputs:
version: ${{ steps.normalize.outputs.version }}
steps:
- name: Normalize version
id: normalize
run: |
VERSION="${{ inputs.version }}"
VERSION="${VERSION#v}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0 # required: hatch-vcs reads tag to set version
ref: ${{ inputs.branch }}
- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create local release tag
run: git tag "v${{ steps.normalize.outputs.version }}"
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Build wheel and sdist
run: uv build
- name: Guard against duplicate tag
run: |
if git ls-remote --tags origin "refs/tags/v${{ steps.normalize.outputs.version }}" | grep -q .; then
echo "::error::Tag v${{ steps.normalize.outputs.version }} already exists on origin. Aborting."
exit 1
fi
- name: Push release tag
run: git push origin "v${{ steps.normalize.outputs.version }}"
- name: Upload dist artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dist
path: dist/
if-no-files-found: error
publish-testpypi:
name: Publish → TestPyPI
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: testpypi
url: https://test.pypi.org/p/orcapod
permissions:
id-token: write # required for OIDC Trusted Publishing
steps:
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Download dist artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: dist
path: dist/
- name: Publish to TestPyPI
run: uv publish --publish-url https://test.pypi.org/legacy/ dist/*
publish-pypi:
name: Publish → PyPI
needs: [build, publish-testpypi]
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: pypi
url: https://pypi.org/p/orcapod
permissions:
id-token: write # required for OIDC Trusted Publishing
contents: write # required for creating GitHub Release
steps:
- name: Install uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Download dist artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: dist
path: dist/
- name: Publish to PyPI
run: uv publish dist/*
- name: Create GitHub Release
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
with:
tag_name: "v${{ needs.build.outputs.version }}"
generate_release_notes: true
files: dist/*
linear-sync:
name: Sync Linear release
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Sync Linear release
uses: linear/linear-release-action@c0cb8354a362c24c6d3e0948f37fd66d07588e3f # v0
with:
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
command: sync
version: "v${{ needs.build.outputs.version }}"
linear-complete:
name: Complete Linear release
needs: [build, publish-pypi, linear-sync]
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Complete Linear release
uses: linear/linear-release-action@c0cb8354a362c24c6d3e0948f37fd66d07588e3f # v0
with:
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
command: complete
version: "v${{ needs.build.outputs.version }}"