-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (116 loc) · 3.16 KB
/
ci.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
name: ci
permissions:
contents: read
pull-requests: read
actions: read
env:
VERSION: "${{ github.ref_name }}"
BUILD_PLATFORMS: "linux/amd64,linux/arm64,darwin/amd64,darwin/arm64,windows/amd64"
PARALLELIZE: "false"
GO_VERSION: "1.21.6"
defaults:
run:
shell: bash
on:
workflow_dispatch: { }
push:
tags:
- "v*.*.*"
branches:
- "main"
paths-ignore:
- "docs/**"
- "**.md"
- "**.mdx"
- "**.png"
- "**.jpg"
pull_request:
branches:
- "main"
paths-ignore:
- "docs/**"
- "**.md"
- "**.mdx"
- "**.png"
- "**.jpg"
jobs:
build:
timeout-minutes: 60
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# checkout the whole histories for commitsar,
# currently commitsar needs full git objects to work correctly.
fetch-depth: 0
persist-credentials: false
- name: Setup Go
timeout-minutes: 15
uses: actions/setup-go@v5
with:
go-version: "${{ env.GO_VERSION }}"
cache-dependency-path: |
**/go.sum
- name: Setup Toolbox
timeout-minutes: 5
uses: actions/cache@v3
with:
# restore/save service binaries, e.g. goimports, golangci-lint, commitsar.
key: toolbox-${{ runner.os }}
path: |
${{ github.workspace }}/.sbin
- name: Build
run: make ci
env:
LINT_DIRTY: "true"
- name: Archive Publish Result
uses: actions/cache/save@v3
with:
# save package resources, e.g. go build result, downloaded UI, entrypoint script.
key: archive-${{ runner.os }}-${{ github.sha }}
path: |
${{ github.workspace }}/.dist/build
release:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs:
- build
permissions:
contents: write
actions: read
id-token: write
timeout-minutes: 20
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
persist-credentials: false
- name: Unarchive Publish Result
timeout-minutes: 5
uses: actions/cache/restore@v3
with:
# restore package resources, e.g. go build result, downloaded UI, entrypoint script.
key: archive-${{ runner.os }}-${{ github.sha }}
path: |
${{ github.workspace }}/.dist/build
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.CI_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.CI_GPG_PASSPHRASE }}
- name: Sign Checksum
run: make release
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ github.token }}
fail_on_unmatched_files: true
tag_name: ${{ steps.metadata.outputs.version }}
prerelease: ${{ contains(github.ref, 'rc') }}
files: |
.dist/build/kubecia/*