-
Notifications
You must be signed in to change notification settings - Fork 99
161 lines (139 loc) · 5.71 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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Release
on:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
deployments: read
packages: none
env:
GO111MODULE: on
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: "go.mod"
cache: false
id: go
# Read changelog and read versions etc.
- name: Check version is mentioned in Changelog.md
id: changelog_reader
uses: mindsers/changelog-reader-action@b97ce03a10d9bdbb07beb491c76a5a01d78cd3ef # v2.2.2
with:
validation_depth: 10
path: "CHANGELOG.md"
# Check if the newest tag already exists
- name: Check if tag exist
uses: mukunku/tag-exists-action@5dfe2bf779fe5259360bb10b2041676713dcc8a3 # v1.1.0
id: check-tag-exists
with:
tag: "v${{ steps.changelog_reader.outputs.version }} release" # following the pattern of vx.x.xx release used in this repo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create Release with artifacts
- name: Create Kubelogin Release
id: create_release
if: ${{ steps.check-tag-exists.outputs.exists == 'false'}}
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ steps.changelog_reader.outputs.version }}"
name: "v${{ steps.changelog_reader.outputs.version }} release" # following the pattern of vx.x.xx release used in this repo
body: ${{ steps.changelog_reader.outputs.changes }}
# We need the latest tag in the git local workspace before it start building.
- name: Get tags
run: git fetch --tags
- name: Build (linux)
env:
GOOS: linux
GOARCH: amd64
run: make
- name: Build (linux/arm64)
env:
GOOS: linux
GOARCH: arm64
run: make
- name: Build (linux/armv7)
env:
GOOS: linux
GOARCH: arm
GOARM: "7"
run: make
- name: Build (darwin)
env:
GOOS: darwin
GOARCH: amd64
run: make
- name: Build (darwin/arm)
env:
GOOS: darwin
GOARCH: arm64
run: make
- name: Build (windows)
env:
GOOS: windows
GOARCH: amd64
run: make
- name: Build (windows/arm)
env:
GOOS: windows
GOARCH: arm64
run: make
- name: Zip
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1
with:
args: zip -qq -r kubelogin.zip bin
- name: Zip (win-amd64)
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1
with:
args: zip -qq kubelogin-win-amd64.zip bin/windows_amd64/kubelogin.exe
- name: Zip (win-arm64)
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1
with:
args: zip -qq kubelogin-win-arm64.zip bin/windows_arm64/kubelogin.exe
- name: Zip (darwin-amd64)
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1
with:
args: zip -qq kubelogin-darwin-amd64.zip bin/darwin_amd64/kubelogin
- name: Zip (darwin-arm64)
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1
with:
args: zip -qq kubelogin-darwin-arm64.zip bin/darwin_arm64/kubelogin
- name: Zip (linux-amd64)
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1
with:
args: zip -qq kubelogin-linux-amd64.zip bin/linux_amd64/kubelogin
- name: Zip (linux-arm64)
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1
with:
args: zip -qq kubelogin-linux-arm64.zip bin/linux_arm64/kubelogin
- name: Zip (linux-armv7)
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1
with:
args: zip -qq kubelogin-linux-armv7.zip bin/linux_armv7/kubelogin
- name: Create sha256 Checksums
run: |
sha256sum kubelogin.zip > kubelogin.zip.sha256
sha256sum kubelogin-win-amd64.zip > kubelogin-win-amd64.zip.sha256
sha256sum kubelogin-win-arm64.zip > kubelogin-win-arm64.zip.sha256
sha256sum kubelogin-darwin-amd64.zip > kubelogin-darwin-amd64.zip.sha256
sha256sum kubelogin-darwin-arm64.zip > kubelogin-darwin-arm64.zip.sha256
sha256sum kubelogin-linux-amd64.zip > kubelogin-linux-amd64.zip.sha256
sha256sum kubelogin-linux-arm64.zip > kubelogin-linux-arm64.zip.sha256
sha256sum kubelogin-linux-armv7.zip > kubelogin-linux-armv7.zip.sha256
- name: Publish
uses: skx/github-action-publish-binaries@44887b225ceca96efd8a912d39c09ad70312af31 # master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: kubelogin.zip kubelogin-win-amd64.zip kubelogin-win-arm64.zip kubelogin-darwin-amd64.zip kubelogin-darwin-arm64.zip kubelogin-linux-amd64.zip kubelogin-linux-arm64.zip kubelogin-linux-armv7.zip kubelogin.zip.sha256 kubelogin-win-amd64.zip.sha256 kubelogin-win-arm64.zip.sha256 kubelogin-darwin-amd64.zip.sha256 kubelogin-darwin-arm64.zip.sha256 kubelogin-linux-amd64.zip.sha256 kubelogin-linux-arm64.zip.sha256 kubelogin-linux-armv7.zip.sha256
releaseId: ${{ steps.create_release.outputs.id }}