-
Notifications
You must be signed in to change notification settings - Fork 29
242 lines (228 loc) · 9.55 KB
/
release.yaml
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
name: release
on:
pull_request:
push:
permissions:
contents: write
jobs:
linux:
runs-on: ubuntu-24.04
steps:
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo "flags=--snapshot" >> $GITHUB_ENV
- name: Install dependencies
run: |
# dpkg --add-architecture arm64
sudo apt update
sudo apt install -yq libgtk-4-dev libgtksourceview-5-dev libadwaita-1-dev libgirepository1.0-dev git zip golang-go libglib2.0-dev-bin libvte-2.91-gtk4-dev
# apt install -yq gcc-aarch64-linux-gnu libc6-dev-arm64-cross libgtk-4-dev:arm64 libgtksourceview-5-dev:arm64 libadwaita-1-dev:arm64 libgirepository1.0-dev:arm64
git config --global --add safe.directory '*'
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
args: release -f build/linux/.goreleaser.yaml --clean ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOOS: linux
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
name: Vendor dependencies
run: |
git archive -o source.zip ${{ github.ref }}
go mod vendor
sed -i 's/"dev"/"${{ github.ref_name }}"/g' main.go
zip -r source.zip vendor main.go
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
name: Upload source to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: source.zip
tag: ${{ github.ref }}
- uses: actions/upload-artifact@v4
with:
name: linux
path: |
dist
source.zip
windows:
needs: linux
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up msys
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: |
git zip
mingw-w64-x86_64-gcc
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-gtk4
mingw-w64-x86_64-libadwaita
mingw-w64-x86_64-gtksourceview5
mingw-w64-x86_64-gobject-introspection
mingw-w64-x86_64-glib2
mingw-w64-x86_64-go
- name: Cache Go
id: go
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/msys64/go
key: ${{ runner.os }}-go
- name: Build
run: |
set -x
git clone --depth 1 --branch go1.22.5 https://github.com/golang/go.git
pushd go/src
curl https://patch-diff.githubusercontent.com/raw/golang/go/pull/68409.patch | git apply
GOROOT_BOOTSTRAP=/mingw64/lib/go cmd //c make.bat
popd
export PATH="$PWD/go/bin:$PATH" GOROOT="$PWD/go" GOPATH=/go GOCACHE=/go/build
#export PATH="/mingw64/bin:$PATH" GOROOT=/mingw64/lib/go GOPATH=/go GOCACHE=/go/build
go run github.com/goreleaser/goreleaser@latest build -f build/windows/.goreleaser.yaml --single-target --snapshot
dist="$(pwd)/dist/seabird_windows_amd64_v1/"
pushd $dist
ldd seabird.exe | grep "=> /mingw64/bin/" | cut -d ' ' -f1 | xargs -I{} cp /mingw64/bin/{} .
for run in {1..5}; do
ldd *.dll | { grep "=> /mingw64/bin/" || true; } | cut -d ' ' -f1 | xargs -I{} cp /mingw64/bin/{} .
done
cp /mingw64/bin/librsvg*.dll /mingw64/bin/gdbus.exe ../../README.md ../../LICENSE .
pushd /mingw64 && cp --parents -r ./share/glib-2.0/schemas/gschemas.compiled ./share/gtk-4.0 ./share/gtksourceview-5 ./share/icons ./lib/gdk-pixbuf-2.0 $dist && popd
- uses: caphyon/advinst-github-action@main
with:
advinst-enable-automation: true
- name: Use Advinst Automation
shell: pwsh
run: |
$advinst = new-object -com advancedinstaller
$aip = join-path $env:GITHUB_WORKSPACE "build\windows\installer.aip"
$project = $advinst.LoadProject($aip)
$project.FilesComponent.AddFolderContent($project.PredefinedFolders.ApplicationFolder, "${{ github.workspace }}\dist\seabird_windows_amd64_v1")
$exe = $project.FilesComponent.FindFileBySourcePath("${{ github.workspace }}\dist\seabird_windows_amd64_v1\seabird.exe")
$shortcut = $project.ShortcutsComponent.CreateFileShortcut($project.PredefinedFolders.ShortcutFolder, $exe)
$shortcut.Name = "tmp" # Can't rename from lowercase: "A file with the same name already exists in this folder"
$shortcut.Name = "Seabird"
$project.BuildComponent.Builds[0].OutputFolder = "${{ github.workspace }}\dist"
$project.BuildComponent.Builds[0].PackageName = "seabird_windows_amd64"
$tag = git describe --tags --abbrev=0
$project.ProductDetails.Version = $tag.replace('v', '')
$project.ProductDetails.ProductCode.GenerateAll()
$project.Build()
- uses: actions/upload-artifact@v4
with:
name: windows
path: dist\seabird_windows_amd64.msi
if-no-files-found: error
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist\seabird_windows_amd64.msi
tag: ${{ github.ref }}
darwin:
needs: linux
strategy:
matrix:
include:
- arch: amd64
builder: macos-13
- arch: arm64
builder: macos-14
name: "darwin-${{ matrix.arch }}"
runs-on: ${{ matrix.builder }}
steps:
- name: Disable XProtect and MDS
run: |
# https://github.com/actions/runner-images/issues/7522
SERVICES=(
"com.apple.XProtect.daemon.scan"
"com.apple.metadata.mds"
"com.apple.metadata.mds.index"
)
for SERVICE in "${SERVICES[@]}"; do
sudo launchctl stop "${SERVICE}"
sudo launchctl disable "system/${SERVICE}"
done
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- uses: actions/setup-go@v5
with:
go-version: stable
- name: Install dependencies
run: |
brew install --force --overwrite gtk4 pkg-config gobject-introspection gtksourceview5 libadwaita hicolor-icon-theme adwaita-icon-theme create-dmg dylibbundler vte3 || true # https://github.com/actions/setup-python/issues/577
- name: Build
run: |
BUILDCMD="go run github.com/goreleaser/goreleaser@latest build -f build/darwin/.goreleaser.yaml --clean --single-target --snapshot"
$BUILDCMD || go clean -cache && $BUILDCMD
dist=dist/seabird_darwin_${{ matrix.arch }}
[[ "${{ matrix.arch }}" == "amd64" ]] && dist=${dist}_v1
brew_prefix=$(brew --prefix)
mkdir -p $dist/lib/gdk-pixbuf-2.0 $dist/share/glib-2.0/schemas $dist/share/icons
cp README.md LICENSE build/darwin/seabird.sh $dist
dylibbundler -b -d $dist/lib -x $dist/seabird
cp -f $brew_prefix/lib/librsvg*.dylib $dist/lib
cp -r $brew_prefix/lib/gdk-pixbuf-2.0 $dist/lib
sed -i '' "s|$brew_prefix/||" $dist/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
cp -r $brew_prefix/share/glib-2.0/schemas $dist/share/glib-2.0
cp -r $brew_prefix/opt/gtksourceview5/share/gtksourceview-5 $dist/share/gtksourceview-5
cp -r $brew_prefix/opt/gtk4/share/gtk-4.0 $dist/share
cp -r $brew_prefix/share/icons/hicolor $brew_prefix/opt/adwaita-icon-theme/share/icons/Adwaita $dist/share/icons
mkdir -p dist/dmg/Seabird.app/Contents/MacOS dist/dmg/Seabird.app/Contents/Resources
cp build/darwin/icon.icns dist/dmg/Seabird.app/Contents/Resources
cp build/darwin/Info.plist dist/dmg/Seabird.app/Contents
cp -r $dist/. dist/dmg/Seabird.app/Contents/MacOS
set +e
false
while [ $? -ne 0 ]; do
create-dmg --volname Seabird --volicon build/darwin/icon.icns --window-size 600 400 --icon-size 100 --icon "Seabird.app" 200 150 --hide-extension "Seabird.app" --app-drop-link 400 150 seabird_darwin_${{ matrix.arch }}.dmg dist/dmg
done
- uses: actions/upload-artifact@v4
with:
name: darwin_${{ matrix.arch }}
path: seabird_darwin_${{ matrix.arch }}.dmg
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: seabird_darwin_${{ matrix.arch }}.dmg
tag: ${{ github.ref }}
automerge:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
needs:
- linux
- windows
- darwin
steps:
- name: Merge
uses: actions/github-script@v7
with:
script: |
github.rest.pulls.merge({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
pull_number: context.payload.pull_request.number
})
github-token: ${{ github.token }}