-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (82 loc) · 2.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
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
name: goreleaser
on:
push:
branches:
- main
tags:
# Create a release on a tag push
- "*"
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
permissions:
contents: write
# packages: write
# issues: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
-
name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Print Go version
run: go version
- name: Print supported platforms
run: go tool dist list
- name: Install syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
syft version
- name: Set ui_file
id: vars
run: |
echo "ui_file=$(pwd)/.tmp/ui.tar.gz" >> $GITHUB_OUTPUT
- name: Set args for goreleaser
id: args
run: |
if ${{ github.ref_type == 'tag' }} ; then
echo "args=release --clean" >> $GITHUB_OUTPUT
else
echo "args=release --clean --skip=validate --skip=publish" >> $GITHUB_OUTPUT
fi
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: "~> v2"
args: ${{ steps.args.outputs.args }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UI_SEPARATOR: "--------UI--------"
UI_FILE: ${{ steps.vars.outputs.ui_file }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
# Needed for syft to generate SBOM also for npm dependencies
- name: Install npm
uses: actions/setup-node@v4
with:
node-version: 18
- name: Get npm dependencies
run: |
cd web
npm install
- name: Generate SBOM
uses: anchore/sbom-action@v0
with:
path: .
artifact-name: sbom.spdx.json
upload-artifact-retention: 14