Repository navigation
171 lines (148 loc) · 5.2 KB
/
Copy pathrelease.yml
File metadata and controls
171 lines (148 loc) · 5.2 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
name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
permissions:
contents: write
jobs:
validate:
name: Validate release tag
runs-on: ubuntu-24.04
outputs:
prerelease: ${{ steps.tag.outputs.prerelease }}
make_latest: ${{ steps.tag.outputs.make_latest }}
steps:
- name: Detect release channel
id: tag
shell: bash
run: |
if [[ "${GITHUB_REF_NAME}" =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$ ]]; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
echo "make_latest=false" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
echo "make_latest=true" >> "$GITHUB_OUTPUT"
fi
build:
name: Build ${{ matrix.name }}
needs: validate
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-amd64
os: ubuntu-24.04
artifact_name: marktyp-linux-amd64
asset_name: marktyp-linux-amd64.tar.gz
package_cmd: tar -czf marktyp-linux-amd64.tar.gz -C build/bin marktyp
- name: windows-amd64
os: windows-2022
artifact_name: marktyp-windows-amd64
asset_name: marktyp-windows-amd64.zip
package_cmd: Compress-Archive -Path build/bin/marktyp.exe -DestinationPath marktyp-windows-amd64.zip
- name: macos-amd64
os: macos-26-intel
artifact_name: marktyp-macos-amd64
asset_name: marktyp-macos-amd64.zip
package_cmd: ditto -c -k --sequesterRsrc --keepParent build/bin/marktyp.app marktyp-macos-amd64.zip
- name: macos-arm64
os: macos-14
artifact_name: marktyp-macos-arm64
asset_name: marktyp-macos-arm64.zip
package_cmd: ditto -c -k --sequesterRsrc --keepParent build/bin/marktyp.app marktyp-macos-arm64.zip
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.19
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Set release version
shell: bash
run: |
node -e 'const fs = require("fs"); const path = "wails.json"; const config = JSON.parse(fs.readFileSync(path, "utf8")); config.info.productVersion = process.argv[1]; fs.writeFileSync(path, JSON.stringify(config, null, 2) + "\n");' "${GITHUB_REF_NAME}"
- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
gcc \
libgtk-3-dev \
libwebkit2gtk-4.1-dev
- name: Install frontend dependencies
run: npm ci
working-directory: frontend
- name: Install Wails CLI
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.15.0
- name: Build app on Linux
if: runner.os == 'Linux'
shell: bash
run: |
"$(go env GOPATH)/bin/wails" build -clean -tags webkit2_41
- name: Build app on macOS
if: runner.os == 'macOS'
shell: bash
run: |
"$(go env GOPATH)/bin/wails" build -clean -ldflags="-extldflags=-Wl,-framework,UniformTypeIdentifiers"
- name: Build app on Windows
if: runner.os == 'Windows'
shell: pwsh
run: |
& "$(go env GOPATH)/bin/wails.exe" build -clean
- name: Package Linux release asset
if: runner.os == 'Linux'
shell: bash
run: ${{ matrix.package_cmd }}
- name: Package macOS release asset
if: runner.os == 'macOS'
shell: bash
run: ${{ matrix.package_cmd }}
- name: Package Windows release asset
if: runner.os == 'Windows'
shell: pwsh
run: ${{ matrix.package_cmd }}
- name: Upload packaged artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.asset_name }}
if-no-files-found: error
release:
name: Publish Release
needs: [validate, build]
runs-on: ubuntu-24.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
- name: Prepare release notes
shell: bash
run: |
NOTES_FILE="docs/releases/${GITHUB_REF_NAME}.md"
if [ -f "$NOTES_FILE" ]; then
cp "$NOTES_FILE" RELEASE_NOTES.md
else
printf '# Marktyp %s\n' "$GITHUB_REF_NAME" > RELEASE_NOTES.md
fi
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
body_path: RELEASE_NOTES.md
files: |
release-assets/**/*.zip
release-assets/**/*.tar.gz
prerelease: ${{ needs.validate.outputs.prerelease == 'true' }}
make_latest: ${{ needs.validate.outputs.make_latest == 'true' }}