forked from deweysasser/eks-kubeconfig-update
-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (121 loc) · 4.03 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
name: Release
on:
push:
tags: [ v* ]
env:
GO_VERSION: 1.19
REPO: ${{github.repository}}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
GOOS: [linux, darwin, windows]
GOARCH: [amd64, arm64]
include:
- GOOS: windows
ext: .exe
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION}}
- name: Repo Name
id: repo-name
run: echo name=$(basename ${{github.repository}}) >> $GITHUB_OUTPUT
- name: Test
run: go test -v ./...
- name: Build
run: make package PROGRAM=bin/${{env.GOOS}}-${{env.GOARCH}}/${{steps.repo-name.outputs.name}}${{matrix.ext}} PACKAGE=dist/${{steps.repo-name.outputs.name}}-${{env.GOOS}}-${{env.GOARCH}}.zip
env:
GOOS: ${{matrix.GOOS}}
GOARCH: ${{matrix.GOARCH}}
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: artifacts
path: dist
retention-days: 1
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs:
- build
- docker-build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Install ChangeLog generator
run: |
wget https://github.com/git-chglog/git-chglog/releases/download/v0.15.1/git-chglog_0.15.1_linux_amd64.tar.gz
tar xzf git-chglog*.tar.gz git-chglog
- name: "Get Last Release"
id: last_release
uses: InsonusK/[email protected]
with:
myToken: ${{ github.token }}
exclude_types: "draft|prerelease"
- name: Generate Changelog for ${{ github.ref_name }}
id: generate-changelog
run: PATH="${PATH}:." make CHANGELOG.md
- name: Generate checksum
run: |
cd artifacts
shasum -a 256 kuconf-linux-arm64.zip >> checksum.txt
shasum -a 256 kuconf-linux-amd64.zip >> checksum.txt
shasum -a 256 kuconf-darwin-arm64.zip >> checksum.txt
shasum -a 256 kuconf-darwin-amd64.zip >> checksum.txt
shasum -a 256 kuconf-windows-arm64.zip >> checksum.txt
shasum -a 256 kuconf-windows-amd64.zip >> checksum.txt
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
files: |
./artifacts/*
body_path: ./CHANGELOG.md
draft: false
docker-build:
runs-on: ubuntu-latest
name: Build the docker image
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
- name: Build Image
run: make image IMAGE=ghcr.io/${{env.REPO}}:${{ github.ref_name }}
- name: Tag latest
run: docker tag ghcr.io/${{env.REPO}}:${{ github.ref_name }} ghcr.io/${{env.REPO}}:latest
- name: Push
run: docker push ghcr.io/${{env.REPO}}:${{ github.ref_name }}
- name: Push Latest
run: docker push ghcr.io/${{env.REPO}}:latest
# uncomment this if you're also using docker hub
# - name: Login to Docker Container Registry
# if: ${{ secrets.DOCKERHUB_TOKEN }}
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Docker Release to Docker Hub
# if: ${{ secrets.DOCKERHUB_TOKEN }}
# uses: docker/build-push-action@v2
# with:
# context: .
# push: true
# tags: |
# ${{env.REPO}}:latest
# ${{env.REPO}}:${{github.ref_name}}