-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (97 loc) · 2.82 KB
/
release.yml
File metadata and controls
109 lines (97 loc) · 2.82 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
109
name: release
on:
release:
types: [published]
env:
GO_VERSION: "1.26.2"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
env:
ASSET: ""
BIN_NAME: fetch
strategy:
matrix:
build:
- linux-amd64
- linux-arm64
- darwin-amd64
- darwin-arm64
- windows-amd64
- windows-arm64
include:
- build: linux-amd64
goos: linux
goarch: amd64
- build: linux-arm64
goos: linux
goarch: arm64
- build: darwin-amd64
goos: darwin
goarch: amd64
- build: darwin-arm64
goos: darwin
goarch: arm64
- build: windows-amd64
goos: windows
goarch: amd64
- build: windows-arm64
goos: windows
goarch: arm64
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
- name: Set bin name
if: ${{ matrix.goos == 'windows' }}
run: echo "BIN_NAME=fetch.exe" >> $GITHUB_ENV
- name: Go build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: go build -trimpath -ldflags="-s -w -buildid=" -o ${{ env.BIN_NAME }}
- name: Build archive (unix)
if: ${{ matrix.goos != 'windows' }}
shell: bash
run: |
staging="fetch-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}"
tar czf "$staging.tar.gz" fetch
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
- name: Build archive (windows)
if: ${{ matrix.goos == 'windows' }}
shell: bash
run: |
staging="fetch-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}"
zip "$staging.zip" fetch.exe
echo "ASSET=$staging.zip" >> $GITHUB_ENV
- name: Upload release archive
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${{ github.ref_name }} ${{ env.ASSET }}
latest:
runs-on: "ubuntu-latest"
needs: release
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Mark release as latest
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release edit ${{ github.ref_name }} --prerelease=false
gh release edit ${{ github.ref_name }} --latest
- name: Notify tap repository
env:
GH_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
run: |
gh api repos/ryanfowler/homebrew-tap/dispatches \
-f event_type=update-fetch \
-f 'client_payload[version]=${{ github.ref_name }}'