-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (65 loc) · 1.77 KB
/
CD.yaml
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
name: CD
on:
push:
branches:
- main
tags:
- v*
permissions:
contents: write
id-token: write
packages: write
jobs:
tag:
name: Tag
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: "[Checkout] repository"
uses: actions/checkout@v4
- name: "[Setup] Install Go"
uses: actions/setup-go@v5
with:
go-version: stable
- name: "[Setup] Install svu"
run: go install github.com/caarlos0/svu@latest
- name: "[CD] Tag release"
if: github.ref == 'refs/heads/main'
run: |
git fetch --tags --force
if [ $(svu current) != $(svu next) ]; then
gh release create $(svu next)
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: "[Checkout] repository"
uses: actions/checkout@v4
- name: "[Setup] Install Go"
uses: actions/setup-go@v5
with:
go-version: stable
- name: "[Setup] Install UPX"
run: sudo apt-get install -y upx
- name: "[Setup] qemu"
uses: docker/setup-qemu-action@v3
- name: "[Setup] buildx"
uses: docker/setup-buildx-action@v3
- name: ghcr login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: "semver"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}