-
-
Notifications
You must be signed in to change notification settings - Fork 2
196 lines (169 loc) · 5.45 KB
/
Copy pathrelease.yml
File metadata and controls
196 lines (169 loc) · 5.45 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
name: release
on:
workflow_dispatch:
inputs:
ref:
description: Tag or commit to release (defaults to latest tag)
required: false
type: string
permissions:
contents: write
jobs:
build:
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: Resolve Release Ref
shell: bash
run: |
ref="${{ github.event.inputs.ref }}"
git fetch --tags --force
if [[ -z "$ref" ]]; then
ref="$(git describe --tags --abbrev=0)"
fi
if [[ -z "$ref" ]]; then
echo "No release tag found." >&2
exit 1
fi
git checkout "$ref"
echo "PAKFU_REF=$ref" >> "$GITHUB_ENV"
- 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:
name: github-release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Resolve Release Ref
shell: bash
run: |
ref="${{ github.event.inputs.ref }}"
git fetch --tags --force
if [[ -z "$ref" ]]; then
ref="$(git describe --tags --abbrev=0)"
fi
if [[ -z "$ref" ]]; then
echo "No release tag found." >&2
exit 1
fi
git checkout "$ref"
echo "PAKFU_REF=$ref" >> "$GITHUB_ENV"
- 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' }}