-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (58 loc) · 2.58 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
name: Release Go Binaries
on:
push:
tags:
- 'v*'
jobs:
go-releaser:
runs-on: ubuntu-latest
permissions:
contents: write # for go-releaser binaries (add and cleanup)
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Use go-releaser to build binaries outside docker
- name: Set up Go
uses: actions/setup-go@v5
- name: Run GoReleaser to build and release binaries (only once on linux/amd64)
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
#args: build --clean # use this if you only need binaries w/o releasing anything
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: Move goreleaser generated binaries to a predictable platform path for docker build
# use target subdirectory app/${{ matrix.platform }}/, which is passed as build arg to docker build,
# copy platform specific binary in actual image (the other one was built in vain, but it's fast :-))
# see also https://goreleaser.com/customization/builds/#why-is-there-a-_v1-suffix-on-amd64-builds
# run: |
# mkdir -p app/linux/amd64
# mkdir -p app/linux/arm64
# mv -v dist/${{ github.event.repository.name }}_linux_amd64_v1/${{ github.event.repository.name }} \
# app/linux/amd64/${{ github.event.repository.name }}
# mv -v dist/${{ github.event.repository.name }}_linux_arm64/${{ github.event.repository.name }} \
# app/linux/arm64/${{ github.event.repository.name }}
# mv -v dist/polly_linux_amd64_v1/polly app/linux/amd64/polly
# mv -v dist/polly_linux_arm64/polly app/linux/arm64/polly
# - name: Upload binaries built by go-releaser
# uses: actions/upload-artifact@v4
# with:
# name: go-releaser-binaries
# path: dist/
# if-no-files-found: error
# retention-days: 1
# https://github.com/marketplace/actions/delete-older-releases
- name: Delete old released binaries
uses: dev-drprasad/[email protected]
with:
#repo: <owner>/<repoName> # defaults to current repo
keep_latest: 5
keep_min_download_counts: 1 # Optional parameters
delete_expired_data: 30 # must set, or nothing gets removed
#delete_tag_pattern: beta # defaults to ""
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}