-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (88 loc) · 3.43 KB
/
Copy pathrelease.yaml
File metadata and controls
108 lines (88 loc) · 3.43 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
name: Release
on:
workflow_dispatch:
release:
types: [published]
permissions:
contents: write
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.23.0]
os: [linux]
arch: [amd64]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: go mod tidy
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 1
run: |
CGO_ENABLED=1 CGO_LDFLAGS="-L/usr/lib" go build -o output/${{ matrix.os }}_${{ matrix.arch }}/preen --ldflags="-extldflags=-static" -tags osusergo,netgo main.go
tar -C output/${{ matrix.os }}_${{ matrix.arch }} -czvf preen-${{ matrix.os }}_${{ matrix.arch }}-${{ github.event.release.tag_name }}.tar.gz preen
echo "Built for $GOOS $GOARCH"
- name: Generate checksum
run: |
sha256sum preen-${{ matrix.os }}_${{ matrix.arch }}-${{ github.event.release.tag_name }}.tar.gz | tee preen-${{ matrix.os }}_${{ matrix.arch }}-${{ github.event.release.tag_name }}.sha256sum
- name: Upload binary
uses: svenstaro/upload-release-action@v2
with:
file: preen-${{ matrix.os }}_${{ matrix.arch }}-${{ github.event.release.tag_name }}.tar.gz
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
- name: Upload checksum
uses: svenstaro/upload-release-action@v2
with:
file: preen-${{ matrix.os }}_${{ matrix.arch }}-${{ github.event.release.tag_name }}.sha256sum
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
build-macos:
runs-on: macos-latest
strategy:
matrix:
go-version: [1.23.0]
os: [darwin]
arch: [arm64, amd64]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: go mod tidy
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 1
run: |
CGO_ENABLED=1 CGO_LDFLAGS="-L/usr/lib" go build -o output/${{ matrix.os }}_${{ matrix.arch }}/preen main.go
tar -C output/${{ matrix.os }}_${{ matrix.arch }} -czvf preen-${{ matrix.os }}_${{ matrix.arch }}-${{ github.event.release.tag_name }}.tar.gz preen
echo "Built for $GOOS $GOARCH"
- name: Generate checksum
run: |
shasum -a 256 preen-${{ matrix.os }}_${{ matrix.arch }}-${{ github.event.release.tag_name }}.tar.gz | tee preen-${{ matrix.os }}_${{ matrix.arch }}-${{ github.event.release.tag_name }}.sha256sum
- name: Upload binary
uses: svenstaro/upload-release-action@v2
with:
file: preen-${{ matrix.os }}_${{ matrix.arch }}-${{ github.event.release.tag_name }}.tar.gz
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
- name: Upload checksum
uses: svenstaro/upload-release-action@v2
with:
file: preen-${{ matrix.os }}_${{ matrix.arch }}-${{ github.event.release.tag_name }}.sha256sum
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}