-
Notifications
You must be signed in to change notification settings - Fork 2
117 lines (115 loc) · 3.75 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
on:
push:
tags:
- "v*"
name: Create Release
jobs:
build-mac:
name: Build on Mac
runs-on: macos-latest
strategy:
matrix:
os: [darwin]
arch: [amd64, arm64]
steps:
- name: Set RELEASE_VERSION
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.18"
- name: Checkout Code
uses: actions/checkout@v3
- name: Build Code
env:
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: "1"
run: go build -ldflags="-X 'github.com/plumber-cd/kubectl-credentials-helper/cmd.Version==${{ env.RELEASE_VERSION }}'" -o build/kubectl-credentials-helper-${{ matrix.os }}-${{ matrix.arch }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: kubectl-credentials-helper
path: build/kubectl-credentials-helper-${{ matrix.os }}-${{ matrix.arch }}
build-linux:
name: Build on Linux
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux]
arch: [amd64]
steps:
- name: Set RELEASE_VERSION
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.18"
- name: Checkout Code
uses: actions/checkout@v3
- name: Build Code
env:
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: "1"
run: go build -ldflags="-X 'github.com/plumber-cd/kubectl-credentials-helper/cmd.Version==${{ env.RELEASE_VERSION }}'" -o build/kubectl-credentials-helper-${{ matrix.os }}-${{ matrix.arch }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: kubectl-credentials-helper
path: build/kubectl-credentials-helper-${{ matrix.os }}-${{ matrix.arch }}
build-windows:
name: Build on Windows
runs-on: windows-latest
strategy:
matrix:
os: [windows]
arch: [amd64, arm64]
steps:
- name: Set RELEASE_VERSION
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.18"
- name: Checkout Code
uses: actions/checkout@v3
- name: Build Code
env:
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: "1"
run: go build -ldflags="-X 'github.com/plumber-cd/kubectl-credentials-helper/cmd.Version==${{ env.RELEASE_VERSION }}'" -o build/kubectl-credentials-helper-${{ matrix.os }}-${{ matrix.arch }}.exe
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: kubectl-credentials-helper
path: build/kubectl-credentials-helper-${{ matrix.os }}-${{ matrix.arch }}.exe
release:
name: Draft Release
runs-on: ubuntu-latest
needs:
- build-mac
- build-linux
- build-windows
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: kubectl-credentials-helper
path: kubectl-credentials-helper
- name: Generate SHA256SUMS
run: |
cd kubectl-credentials-helper && sha256sum * > SHA256SUMS
- name: List Artifacts
run: echo "ARTIFACTS=$(echo kubectl-credentials-helper/*)" >> $GITHUB_ENV
- name: Release
uses: docker://antonyurchenko/git-release:v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "true"
PRE_RELEASE: "false"
CHANGELOG_FILE: "CHANGELOG.md"
ALLOW_EMPTY_CHANGELOG: "false"
with:
args: |
${{ env.ARTIFACTS }}