-
-
Notifications
You must be signed in to change notification settings - Fork 2
247 lines (213 loc) · 6.87 KB
/
Copy pathauto_version.yml
File metadata and controls
247 lines (213 loc) · 6.87 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
name: auto-version
on:
workflow_dispatch:
inputs:
channel:
description: Release channel
required: true
default: dev
type: choice
options:
- stable
- beta
- dev
permissions:
contents: write
actions: write
concurrency:
group: auto-version
cancel-in-progress: false
jobs:
tag:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
outputs:
tagged: ${{ steps.tag.outputs.tagged }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Compute Version
id: version
shell: bash
run: |
channel="${{ github.event.inputs.channel }}"
if [[ -z "$channel" ]]; then
channel="dev"
fi
version="$(python scripts/next_version.py --channel "$channel" --write)"
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Update Changelog
shell: bash
run: |
python scripts/update_changelog.py --version "${{ steps.version.outputs.version }}"
- name: Validate Documentation Version
shell: bash
run: |
python scripts/sync_doc_versions.py --check
- name: Commit and Tag
id: tag
shell: bash
run: |
echo "tagged=false" >> "$GITHUB_OUTPUT"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add VERSION README.md docs CHANGELOG.md
if git diff --cached --quiet; then
echo "VERSION unchanged; nothing to tag."
exit 0
fi
git commit -m "chore(release): v${{ steps.version.outputs.version }} [skip release]"
git tag "v${{ steps.version.outputs.version }}"
git push
git push --tags
echo "tagged=true" >> "$GITHUB_OUTPUT"
build:
needs: tag
if: needs.tag.outputs.tagged == 'true'
name: build-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout Release Tag
shell: bash
run: |
git fetch --tags --force
git checkout "v${{ needs.tag.outputs.version }}"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Meson + Ninja
run: python -m pip install --upgrade pip meson ninja
- name: Setup MSVC
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: "6.10.1"
arch: ${{ matrix.os == 'windows-latest' && 'win64_msvc2022_64' || matrix.os == 'macos-latest' && 'clang_64' || 'linux_gcc_64' }}
modules: qtmultimedia qtimageformats
- name: Determine Update Channel
shell: bash
run: |
version="$(cat VERSION)"
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "PAKFU_UPDATE_CHANNEL=dev" >> "$GITHUB_ENV"
else
echo "PAKFU_UPDATE_CHANNEL=stable" >> "$GITHUB_ENV"
fi
- name: Configure (Windows)
if: matrix.os == 'windows-latest'
env:
CC: cl
CXX: cl
run: meson setup builddir --backend ninja --buildtype=release -Dgithub_repo=${{ github.repository }} -Dupdate_channel=$PAKFU_UPDATE_CHANNEL
- name: Configure (Unix)
if: matrix.os != 'windows-latest'
run: meson setup builddir --backend ninja --buildtype=release -Dgithub_repo=${{ github.repository }} -Dupdate_channel=$PAKFU_UPDATE_CHANNEL
- name: Build
run: meson compile -C builddir
- name: Package (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: ./scripts/package_windows.ps1
- name: Package (macOS)
if: matrix.os == 'macos-latest'
shell: bash
run: bash scripts/package_macos.sh
- name: Package (Linux)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: bash scripts/package_linux.sh
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: pakfu-${{ matrix.os }}
path: |
dist/*.zip
dist/*.tar.gz
dist/*.tgz
dist/*.tar.xz
dist/*.AppImage
dist/*.dmg
dist/*.pkg
dist/*.exe
dist/*.msi
release:
needs: [tag, build]
if: needs.tag.outputs.tagged == 'true'
name: github-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout Release Tag
shell: bash
run: |
git fetch --tags --force
git checkout "v${{ needs.tag.outputs.version }}"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Resolve Version
shell: bash
run: |
version="$(cat VERSION)"
echo "PAKFU_VERSION=$version" >> "$GITHUB_ENV"
- name: Determine Release Type
shell: bash
run: |
version="${PAKFU_VERSION}"
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "PAKFU_PRERELEASE=true" >> "$GITHUB_ENV"
else
echo "PAKFU_PRERELEASE=false" >> "$GITHUB_ENV"
fi
- name: Validate Packaged Assets
shell: bash
run: |
python scripts/validate_release_assets.py --dist dist --version "${PAKFU_VERSION}"
- name: Generate Distribution Manifest
shell: bash
run: |
python scripts/release_manifest.py \
--dist dist \
--version "${PAKFU_VERSION}" \
--output "dist/pakfu-${PAKFU_VERSION}-release-manifest.json"
- name: Prepare Release Notes
shell: bash
run: |
python scripts/release_notes.py --version "v${PAKFU_VERSION}" --output release_notes.md
- name: Publish Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.PAKFU_VERSION }}
name: v${{ env.PAKFU_VERSION }}
files: dist/**
body_path: release_notes.md
generate_release_notes: false
fail_on_unmatched_files: true
prerelease: ${{ env.PAKFU_PRERELEASE == 'true' }}