-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (74 loc) · 1.9 KB
/
ci.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
name: build/test
on:
workflow_call:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.21"]
os: ["linux"]
arch: ["amd64"]
steps:
- uses: actions/checkout@v3
- uses: benjlevesque/[email protected]
id: short-sha
- name: Set up golang ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: build
run: |
make binary OS=${{ matrix.os }} ARCH=${{ matrix.arch }}
- name: lint
run: |
make lint
- name: test
run: |
make test
- name: Upload code coverage
uses: codecov/codecov-action@v3
- uses: actions/cache/save@v3
if: always()
with:
file: bin/stacker-sbom-*
key: ${{ github.sha }}
release:
if: github.event_name == 'release' && github.event.action== 'published'
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.21"]
os: ["linux"]
arch: ["amd64"]
steps:
- uses: actions/checkout@v3
- name: Set up golang ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: build
run: |
make binary RELEASE_TAG=${{ github.event.release.tag_name }} OS=${{ matrix.os }} ARCH=${{ matrix.arch }}
- uses: actions/cache/save@v3
if: always()
with:
path: bin/sbom
key: ${{ github.ref }}
- name: Publish artifacts on releases
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: bin/stacker-bom-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true