-
-
Notifications
You must be signed in to change notification settings - Fork 4
91 lines (90 loc) · 2.93 KB
/
release.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
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
name: Release
on:
push:
branches:
- "test-release*"
- "*dist*"
tags:
- v[0-9].[0-9]+.[0-9]+
jobs:
build:
name: build-rz-pm
runs-on: ubuntu-22.04
strategy:
matrix:
goos: [windows, darwin, freebsd, openbsd, netbsd, linux, android]
goarch: [amd64, arm64]
include:
- goarch: amd64
asset_arch: x86_64
- goarch: arm64
asset_arch: arm64
- goos: linux
goarch: arm
asset_arch: arm7
goarm: 7
- goos: linux
goarch: ppc64le
asset_arch: ppc64le
- goos: linux
goarch: s390x
asset_arch: s390x
- goos: android
goarch: arm64
asset_arch: arm64
- goos: android
goarch: arm
asset_arch: arm
goarm: 7
cgo_enabled: 1
cc: /tmp/android-ndk/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.19
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Install Android NDK
if: matrix.goos == 'android'
run: |
curl -L https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip -o android-ndk.zip
unzip android-ndk.zip -d /tmp/android-ndk
- name: Build the Go binary
run: go build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
CGO_ENABLED: ${{ matrix.cgo_enabled }}
CC: ${{ matrix.cc }}
- name: Rename rz-pm
run: mv ./rz-pm${{ matrix.goos == 'windows' && '.exe' || '' }} ./rz-pm-${{ matrix.goos }}-${{ matrix.asset_arch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
- name: Upload rz-pm build
uses: actions/upload-artifact@v3
with:
name: rz-pm-${{ matrix.goos }}-${{ matrix.asset_arch }}
path: ./rz-pm-${{ matrix.goos }}-${{ matrix.asset_arch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
create_release:
name: create_release
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/') || contains(github.ref, 'test-release')
needs: [build]
steps:
- uses: actions/checkout@v2
- name: Check version matches
if: startsWith(github.ref, 'refs/tags/')
run: |
[[ "$(grep app.Version main.go | sed -r 's/.*\"(v[0-9\.]+)\"/\1/')" =~ "${{ github.ref_name }}" ]]
- uses: actions/download-artifact@v3
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Release ${{ github.ref }}
draft: true
prerelease: false
files: |
./rz-pm-*/*