-
Notifications
You must be signed in to change notification settings - Fork 3
67 lines (65 loc) · 2.05 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
name: Prepare release
on:
push:
tags:
- 'v*'
jobs:
create_release:
runs-on: ubuntu-20.04
steps:
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: "Waggle ${{ github.ref_name }}"
body: |
Version ${{ github.ref_name }} of the Waggle library and command line tool
draft: true
prerelease: false
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload_assets:
runs-on: ubuntu-20.04
needs: create_release
strategy:
fail-fast: true
matrix:
os: ["linux", "darwin", "windows"]
arch: ["386", "amd64", "arm64"]
exclude:
- os: "darwin"
arch: "arm"
- os: "darwin"
arch: "386"
- os: "windows"
arch: "arm"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ^1.20.0
- name: Build binary for each valid (GOOS, GOARCH) pair
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
BUILD_DIR="waggle-${{ github.ref_name }}-${GOOS}-${GOARCH}"
EXTENSION=""
if [ "$GOOS" = "windows" ]; then
EXTENSION=".exe"
fi
mkdir "$BUILD_DIR"
cp README.md "$BUILD_DIR/README.md"
go build -o "$BUILD_DIR/waggle${EXTENSION}" ./...
zip -r "$BUILD_DIR.zip" "$BUILD_DIR"
- name: Upload release asset for each valid (GOOS, GOARH) pair
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./waggle-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}.zip
asset_name: waggle-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}.zip
asset_content_type: application/zip