-
Notifications
You must be signed in to change notification settings - Fork 1
133 lines (110 loc) · 4.02 KB
/
Copy pathrelease.yml
File metadata and controls
133 lines (110 loc) · 4.02 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/matchpatch
permissions:
contents: read
id-token: write
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Install uv and Python
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: false
python-version: "3.14"
- name: Verify tag matches package version
shell: bash
run: |
package_version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
test "${GITHUB_REF_NAME}" = "v${package_version}"
- name: Build distributions
run: uv build --no-sources
- name: Smoke test wheel
shell: bash
run: uv run --isolated --no-project --with dist/*.whl python -c "import matchpatch"
- name: Smoke test source distribution
shell: bash
run: uv run --isolated --no-project --with dist/*.tar.gz python -c "import matchpatch"
- name: Synchronize docs environment
run: uv sync --locked --no-default-groups --group docs
- name: Build offline docs
run: uv run --frozen --no-default-groups --group docs sphinx-build -W --keep-going -b html docs docs_html
- name: Stage installer docs payload
shell: bash
run: |
mkdir -p installer-payload/docs_html
cp -a docs_html/. installer-payload/docs_html/
test -f installer-payload/docs_html/index.html
- name: Upload installer docs payload
uses: actions/upload-artifact@v7
with:
name: matchpatch-docs-html-${{ github.ref_name }}
path: installer-payload/
if-no-files-found: error
- name: Publish distributions
run: uv publish
windows-installer:
name: Windows installer
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Install uv and Python
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: false
python-version: "3.12"
- name: Resolve package version
id: version
shell: pwsh
run: |
$version = python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])"
if ($env:GITHUB_REF_NAME -ne "v$version") {
throw "Release tag '$env:GITHUB_REF_NAME' does not match package version 'v$version'."
}
"version=$version" >> $env:GITHUB_OUTPUT
"installer=dist/installer/MatchPatch-Setup-$version.exe" >> $env:GITHUB_OUTPUT
- name: Install Inno Setup
run: choco install innosetup --no-progress -y
- name: Build and test installer
shell: cmd
run: scripts\test-windows-installer.cmd
- name: Upload installer artifact
uses: actions/upload-artifact@v7
with:
name: matchpatch-installer-${{ github.ref_name }}
path: ${{ steps.version.outputs.installer }}
if-no-files-found: error
- name: Attach installer to GitHub Release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$tag = $env:GITHUB_REF_NAME
$installer = "${{ steps.version.outputs.installer }}"
if (-not (Test-Path -LiteralPath $installer)) {
throw "Installer artifact was not found: $installer"
}
gh release view $tag 2>$null
if ($LASTEXITCODE -ne 0) {
gh release create $tag --title $tag --notes "MatchPatch $tag"
if ($LASTEXITCODE -ne 0) {
throw "Failed to create GitHub Release for $tag."
}
}
gh release upload $tag $installer --clobber