-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (48 loc) · 1.42 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
name: Publish Release Artifacts
on:
release:
types:
- published
- edited
permissions:
contents: read
jobs:
build-and-publish:
strategy:
matrix:
os: [linux, darwin, windows]
arch: [amd64, arm64]
env:
TOOL_NAME: cleanup-ecr
OUTPUT_FOLDER: dist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: '0' # disable linking of glibc
run: |
mkdir -p "./${OUTPUT_FOLDER}"
go build -C "./cmd/${TOOL_NAME}" -o "$(pwd)/${OUTPUT_FOLDER}/${TOOL_NAME}"
- uses: thedoctor0/[email protected]
with:
type: zip
directory: ${{ env.OUTPUT_FOLDER }}
path: ${{ env.TOOL_NAME }}
filename: ${{ env.TOOL_NAME }}-${{ matrix.os }}-${{ matrix.arch }}.zip
custom: '-9' # highest compression
- name: Upload Release Artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.event.release.tag_name }}
BUILT_OS: ${{ matrix.os }}
BUILT_ARCH: ${{ matrix.arch }}
run: |
gh release upload --clobber "${TAG_NAME}" \
"./${OUTPUT_FOLDER}/${TOOL_NAME}-${BUILT_OS}-${BUILT_ARCH}.zip"