-
Notifications
You must be signed in to change notification settings - Fork 6
134 lines (113 loc) · 3.41 KB
/
golang.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
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
130
131
132
133
134
name: Go Checks
on:
push:
branches:
- '**'
tags:
- 'v*'
paths:
- 'go.sum'
- 'go.mod'
- '**.go'
- .github/workflows/golang.yml
- './cmd/cloudflare-utils/.goreleaser.yml'
pull_request:
branches:
- main
paths:
- '**.go'
- 'go.sum'
- 'go.mod'
permissions:
security-events: write
actions: write
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Snapshot:
if: ${{ startsWith(github.ref, 'refs/tags/v') == false }}
runs-on: windows-latest
env:
GO111MODULE: on
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false
- uses: actions/cache@v4
with:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
key: go-${{ hashFiles('go.sum') }}
restore-keys: |
go-
- name: Install Syft
run: choco install syft --yes
#- name: Test
# run: make test
- name: Download AutoComplete file
run: Invoke-WebRequest -Uri https://raw.githubusercontent.com/urfave/cli/v2.25.7/autocomplete/bash_autocomplete -OutFile bash_completion
- name: GoReleaser Action
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: --snapshot --clean --skip=publish,sign
workdir: cmd/cloudflare-utils
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload assets
uses: actions/upload-artifact@v4
with:
name: cloudflare-utils
path: cmd/cloudflare-utils/dist/*
Release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: windows-latest
env:
GO111MODULE: on
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: false
- name: Install Syft
run: choco install syft --yes
- uses: actions/cache@v4
with:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
key: go-${{ hashFiles('go.sum') }}
- name: Download AutoComplete file
run: Invoke-WebRequest -Uri https://raw.githubusercontent.com/urfave/cli/v2.25.7/autocomplete/bash_autocomplete -OutFile bash_completion
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --clean
workdir: cmd/cloudflare-utils
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}