Repository navigation
244 lines (216 loc) · 9.31 KB
/
Copy pathrelease.yml
File metadata and controls
244 lines (216 loc) · 9.31 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
name: Release
# A version tag (v0.1.0) builds the Windows MSI, the macOS .dmg files and the Linux .deb and
# .tar.gz and publishes them as a GitHub release. A pull request that changes the packaging, or a run by hand, builds the same
# installers as workflow artifacts only, so packaging is proven before anything is tagged.
on:
push:
tags: ['v*']
pull_request:
paths:
- 'packaging/**'
- '.github/workflows/release.yml'
workflow_dispatch:
# Read-only by default; only the release job escalates to contents: write.
permissions:
contents: read
env:
PUBLISH_FLAGS: >-
-c Release --self-contained true
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
-p:DebugType=none -p:DebugSymbols=false
jobs:
version:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
version: ${{ steps.v.outputs.version }}
msi_version: ${{ steps.v.outputs.msi_version }}
prerelease: ${{ steps.v.outputs.prerelease }}
steps:
# Tag push: the tag without its "v". Otherwise a dev version that never collides with a tag.
# WiX accepts only a numeric ProductVersion, so the MSI carries the numeric core.
- id: v
env:
EVENT: ${{ github.event_name }}
REF_NAME: ${{ github.ref_name }}
RUN_NUMBER: ${{ github.run_number }}
run: |
if [ "$EVENT" = "push" ]; then
version="${REF_NAME#v}"
else
version="0.0.0-dev.${RUN_NUMBER}"
fi
if ! printf '%s' "$version" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$'; then
echo "::error::Not a version: $version"
exit 1
fi
core="${version%%-*}"
prerelease=false
[ "$version" != "$core" ] && prerelease=true
{
echo "version=$version"
echo "msi_version=$core"
echo "prerelease=$prerelease"
} >> "$GITHUB_OUTPUT"
windows:
needs: version
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: '10.0.x'
- name: Publish
shell: pwsh
env:
VERSION: ${{ needs.version.outputs.version }}
run: >
dotnet publish src/Freizeichen.App/Freizeichen.App.csproj -r win-x64 ${{ env.PUBLISH_FLAGS }}
"-p:Version=$env:VERSION" -o publish
# The GITHUB_PATH write appends a fixed directory, nothing derived from input.
- name: Install WiX
shell: pwsh
run: | # zizmor: ignore[github-env]
dotnet tool install --global wix --version 5.0.2
echo "$env:USERPROFILE\.dotnet\tools" >> $env:GITHUB_PATH
# Absolute PublishDir: WiX resolves <Files Include> relative to the .wxs file's directory.
# -arch x64: WiX defaults to x86, which would install into "Program Files (x86)".
- name: Build MSI
shell: pwsh
env:
VERSION: ${{ needs.version.outputs.version }}
MSI_VERSION: ${{ needs.version.outputs.msi_version }}
run: >
wix build packaging/windows/Freizeichen.wxs -arch x64
-d "Version=$env:MSI_VERSION"
-d "PublishDir=$env:GITHUB_WORKSPACE\publish"
-d "IconFile=$env:GITHUB_WORKSPACE\src\Freizeichen.App\Assets\icon.ico"
-o "freizeichen-$env:VERSION-windows-x64.msi"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: windows
path: '*.msi'
if-no-files-found: error
# macOS runners bill at 10x in a private repository: the .dmg is built for a release tag or a
# manual run, not for every pull request that touches the packaging.
macos:
needs: version
if: github.event_name != 'pull_request'
strategy:
fail-fast: false
matrix:
include:
- rid: osx-arm64
arch: arm64
- rid: osx-x64
arch: x64
runs-on: macos-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: '10.0.x'
- name: Publish
env:
VERSION: ${{ needs.version.outputs.version }}
RID: ${{ matrix.rid }}
run: >
dotnet publish src/Freizeichen.App/Freizeichen.App.csproj -r "$RID" ${{ env.PUBLISH_FLAGS }}
"-p:Version=${VERSION}" -o publish
- name: Build .dmg
env:
VERSION: ${{ needs.version.outputs.version }}
ARCH: ${{ matrix.arch }}
run: packaging/macos/build-dmg.sh "$VERSION" publish "$ARCH" dist
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: macos-${{ matrix.arch }}
path: dist/*.dmg
if-no-files-found: error
linux:
needs: version
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: '10.0.x'
- name: Publish
env:
VERSION: ${{ needs.version.outputs.version }}
run: >
dotnet publish src/Freizeichen.App/Freizeichen.App.csproj -r linux-x64 ${{ env.PUBLISH_FLAGS }}
"-p:Version=${VERSION}" -o publish
# build-linux.sh renders the icon theme's sizes with rsvg-convert, which the runner lacks.
- name: Install packaging tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends librsvg2-bin
- name: Build .deb and .tar.gz
env:
VERSION: ${{ needs.version.outputs.version }}
run: packaging/linux/build-linux.sh "$VERSION" publish dist
# Installing the .deb proves its dependencies resolve on a current Ubuntu.
- name: Check packages
env:
VERSION: ${{ needs.version.outputs.version }}
run: |
sudo apt-get update
sudo apt-get install -y desktop-file-utils appstream ./dist/*.deb
test -x /usr/bin/freizeichen
desktop-file-validate /usr/share/applications/freizeichen.desktop
appstreamcli validate --no-net /usr/share/metainfo/de.codeforfire.freizeichen.metainfo.xml
test -f /usr/share/icons/hicolor/48x48/apps/freizeichen.png
test -f /usr/share/icons/hicolor/scalable/apps/freizeichen.svg
tar -tzf "dist/freizeichen-${VERSION}-linux-x64.tar.gz" | grep -qx "freizeichen-${VERSION}/Freizeichen"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: linux
path: dist/*
if-no-files-found: error
release:
if: github.event_name == 'push'
needs: [version, windows, macos, linux]
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write # create the release and upload its assets
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
path: dist
merge-multiple: true
- name: Checksums
working-directory: dist
run: sha256sum -- * > SHA256SUMS.txt
- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
VERSION: ${{ needs.version.outputs.version }}
PRERELEASE: ${{ needs.version.outputs.prerelease }}
run: |
cat > notes.md <<NOTES
Freizeichen ${VERSION} – wählt \`tel:\`-Links über ein Bluetooth-Telefon, getestet mit dem Gigaset DL500A.
**Installation**
- **Windows**: \`freizeichen-${VERSION}-windows-x64.msi\` ausführen. Danach Freizeichen starten, den Bluetooth-Port wählen und „Als Standard festlegen“ drücken.
- **macOS**: Die passende \`.dmg\` öffnen (\`arm64\` für Apple-Chips, \`x64\` für Intel) und Freizeichen in „Programme“ ziehen.
- **Linux** (x64): Debian/Ubuntu: \`sudo apt install ./freizeichen_*_amd64.deb\`, danach \`freizeichen\` starten. Andere Distributionen: \`freizeichen-${VERSION}-linux-x64.tar.gz\` entpacken und \`Freizeichen\` starten. Das Telefon mit \`sudo rfcomm bind 0 <MAC> 1\` als \`/dev/rfcomm0\` anlegen; der Benutzer braucht die Gruppe \`dialout\`. Beim \`.tar.gz\` „Als Standard festlegen“ drücken.
**Die Pakete sind nicht signiert.** Beim ersten Start:
- **Windows**: SmartScreen → „Weitere Informationen“ → „Trotzdem ausführen“.
- **macOS**: Rechtsklick auf Freizeichen.app → „Öffnen“ (einmalig bestätigen).
**Prüfsummen**: \`SHA256SUMS.txt\` – \`sha256sum -c SHA256SUMS.txt\` (Linux) bzw. \`shasum -a 256 -c SHA256SUMS.txt\` (macOS).
NOTES
flags=()
[ "$PRERELEASE" = "true" ] && flags+=(--prerelease)
gh release create "$TAG" dist/* --repo "$REPO" --title "Freizeichen ${VERSION}" --notes-file notes.md "${flags[@]}"