-
Notifications
You must be signed in to change notification settings - Fork 79
64 lines (57 loc) · 1.94 KB
/
binaries.yml
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
name: Build release binaries
on:
push:
branches: ['travis/release-bin']
release:
types: ['published']
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
arch:
- amd64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Install libheif
if: runner.os == 'linux'
run: "chmod +x ./.github/workflows/build-libheif.sh && ./.github/workflows/build-libheif.sh"
- name: Dist
if: runner.os == 'linux'
run: |
set -ex
platform=${{ runner.os }}
platform=${platform,,}
mkdir -p $PWD/bin/dist
GOBIN=$PWD/bin go install -v ./cmd/utilities/compile_assets
$PWD/bin/compile_assets
pth="$platform-${{ matrix.arch }}"
mkdir -p $PWD/bin/$pth
GOOS=$platform GOARCH=${{ matrix.arch }} GOBIN=$PWD/bin go build -o $PWD/bin/$pth -a -ldflags "-X github.com/t2bot/matrix-media-repo/common/version.Version=$(git describe --tags)" -v ./cmd/...
GOOS=$platform GOARCH=${{ matrix.arch }} GOBIN=$PWD/bin go build -pgo=pgo_media_repo.pprof -o $PWD/bin/$pth -a -ldflags "-X github.com/t2bot/matrix-media-repo/common/version.Version=$(git describe --tags)" -v ./cmd/workers/media_repo
cd $PWD/bin/$pth
arch=${{ matrix.arch }}
if [ "$arch" == "amd64" ]; then
arch="x64"
fi
for file in * ; do mv -v $file ../dist/${file}-${platform_os}-${arch}; done;
cd ../../
rm -rv $PWD/bin/dist/compile_assets*
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.arch }}
path: ./bin/dist/*