-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (112 loc) · 3.84 KB
/
go.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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Go
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
permissions:
checks: write
contents: write
packages: write
pull-requests: write
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
fetch-tags: "true"
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: go.sum
check-latest: true
- name: Init go
run: |
go mod download
go mod download -modfile tools/go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
GOPROXY: direct
- id: govulncheck
uses: golang/govulncheck-action@v1
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
go-version-file: go.mod
go-package: ./...
- name: Test
run: |
go run -modfile ./tools/go.mod gotest.tools/gotestsum --format pkgname --junitfile out/junit.xml -- -race -shuffle=on -covermode=atomic ./...
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: git-age@${{ matrix.os }}
path: out/junit.xml
reporter: java-junit
# Do not run release on windows
- uses: ruby/setup-ruby@v1
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
ruby-version: "3.3"
bundler-cache: true
- run: gem install asciidoctor
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Setup Syft
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Prepare GPG setup
run: |
mkdir -p $GITHUB_WORKSPACE/.gnupg
echo "${{ secrets.GPG_SIGNING_KEY }}" | base64 -d > $GITHUB_WORKSPACE/.gnupg/gpg.key
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Snapshot release
uses: goreleaser/goreleaser-action@v6
if: ${{ matrix.os == 'ubuntu-latest' && !startsWith(github.ref, 'refs/tags/v') }}
with:
distribution: goreleaser
version: latest
args: release --clean --snapshot
env:
NFPM_GIT_AGE_PASSPHRASE: ${{ secrets.NFPM_GIT_AGE_PASSPHRASE }}
- name: Release
uses: goreleaser/goreleaser-action@v6
if: ${{ matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/v') }}
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TAP_PAT: ${{ secrets.GH_TAP_PAT }}
GH_WINGET_PAT: ${{ secrets.GH_WINGET_PAT }}
GH_SCOOP_PAT: ${{ secrets.GH_SCOOP_PAT }}
NFPM_GIT_AGE_PASSPHRASE: ${{ secrets.NFPM_GIT_AGE_PASSPHRASE }}
AUR_KEY: ${{ secrets.AUR_SSH_KEY }}
- name: Upload RPM packages
if: ${{ matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/v') }}
run: |
for rpm in dist/*.rpm; do
curl --user prskr:${{ secrets.UPLOAD_RPM_SECRET }} \
--upload-file "${rpm}" \
https://code.icb4dc0.de/api/packages/prskr/rpm/upload
done
- name: Upload DEB packages
if: ${{ matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/v') }}
run: |
for deb in dist/*.deb; do
curl --user prskr:${{ secrets.UPLOAD_DEB_SECRET }} \
--upload-file "${deb}" \
https://code.icb4dc0.de/api/packages/prskr/debian/pool/bookworm/main/upload
done