Skip to content

Commit 87efe8c

Browse files
authored
Add Github actions for PR, push, and release (#8)
Add Github actions to: 1. build, test, and verify PRs 2. build and test on pushes to main 3. Create release and release artifacts on pushes of version tags
1 parent f9d0ce6 commit 87efe8c

File tree

2 files changed

+269
-0
lines changed

2 files changed

+269
-0
lines changed

.github/workflows/build_test.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build and test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
name: Build and Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: Set up Go 1.x
16+
uses: actions/setup-go@v2
17+
with:
18+
go-version: ^1.15
19+
id: go
20+
21+
- name: Check out code into the Go module directory
22+
uses: actions/checkout@v2
23+
24+
- name: Get dependencies
25+
run: make bootstrap
26+
27+
- name: Build
28+
run: make dev
29+
30+
- name: Test
31+
run: make test-acc
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
on:
2+
push:
3+
# Sequence of patterns matched against refs/tags
4+
tags:
5+
- 'v*'
6+
7+
name: Build release
8+
9+
jobs:
10+
build:
11+
name: Build and upload release
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Set up Go 1.x
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: ^1.15
18+
id: go
19+
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Get dependencies
24+
run: make bootstrap
25+
26+
- name: Build
27+
run: make
28+
29+
- name: Get the release version
30+
id: get_version
31+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
32+
33+
- name: Rename output zips to contain version number
34+
run: |
35+
mv darwin_amd64.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_darwin_amd64.zip
36+
mv freebsd_386.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_freebsd_386.zip
37+
mv freebsd_amd64.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_freebsd_amd64.zip
38+
mv freebsd_arm.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_freebsd_arm.zip
39+
mv linux_386.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_386.zip
40+
mv linux_amd64.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_amd64.zip
41+
mv linux_arm.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_arm.zip
42+
mv linux_arm64.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_arm64.zip
43+
mv netbsd_386.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_netbsd_386.zip
44+
mv netbsd_amd64.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_netbsd_amd64.zip
45+
mv netbsd_arm.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_netbsd_arm.zip
46+
mv openbsd_386.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_openbsd_386.zip
47+
mv openbsd_amd64.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_openbsd_amd64.zip
48+
mv solaris_amd64.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_solaris_amd64.zip
49+
mv windows_386.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_windows_386.zip
50+
mv windows_amd64.zip vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_windows_amd64.zip
51+
working-directory: ./pkg
52+
53+
- name: Generate SHA256 sums
54+
id: generate_sha256
55+
run: shasum -a 256 *.zip > vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_SHA256SUMS
56+
working-directory: ./pkg
57+
58+
- name: Create Release
59+
id: create_release
60+
uses: actions/create-release@v1
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
with:
64+
tag_name: ${{ github.ref }}
65+
release_name: Release ${{ github.ref }}
66+
draft: false
67+
prerelease: false
68+
69+
- name: Upload shasums file
70+
uses: actions/upload-release-asset@v1
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
with:
74+
upload_url: ${{ steps.create_release.outputs.upload_url }}
75+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_SHA256SUMS
76+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_SHA256SUMS
77+
asset_content_type: text/plain
78+
79+
- name: Upload darwin_amd64
80+
uses: actions/upload-release-asset@v1
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
with:
84+
upload_url: ${{ steps.create_release.outputs.upload_url }}
85+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_darwin_amd64.zip
86+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_darwin_amd64.zip
87+
asset_content_type: application/zip
88+
89+
- name: Upload freebsd_386
90+
uses: actions/upload-release-asset@v1
91+
env:
92+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
with:
94+
upload_url: ${{ steps.create_release.outputs.upload_url }}
95+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_freebsd_386.zip
96+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_freebsd_386.zip
97+
asset_content_type: application/zip
98+
99+
- name: Upload freebsd_amd64
100+
uses: actions/upload-release-asset@v1
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
with:
104+
upload_url: ${{ steps.create_release.outputs.upload_url }}
105+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_freebsd_amd64.zip
106+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_freebsd_amd64.zip
107+
asset_content_type: application/zip
108+
109+
- name: Upload freebsd_arm
110+
uses: actions/upload-release-asset@v1
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
with:
114+
upload_url: ${{ steps.create_release.outputs.upload_url }}
115+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_freebsd_arm.zip
116+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_freebsd_arm.zip
117+
asset_content_type: application/zip
118+
119+
- name: Upload linux_386
120+
uses: actions/upload-release-asset@v1
121+
env:
122+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123+
with:
124+
upload_url: ${{ steps.create_release.outputs.upload_url }}
125+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_386.zip
126+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_386.zip
127+
asset_content_type: application/zip
128+
129+
- name: Upload linux_amd64
130+
uses: actions/upload-release-asset@v1
131+
env:
132+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133+
with:
134+
upload_url: ${{ steps.create_release.outputs.upload_url }}
135+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_amd64.zip
136+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_amd64.zip
137+
asset_content_type: application/zip
138+
139+
- name: Upload linux_arm
140+
uses: actions/upload-release-asset@v1
141+
env:
142+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143+
with:
144+
upload_url: ${{ steps.create_release.outputs.upload_url }}
145+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_arm.zip
146+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_arm.zip
147+
asset_content_type: application/zip
148+
149+
- name: Upload linux_arm64
150+
uses: actions/upload-release-asset@v1
151+
env:
152+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153+
with:
154+
upload_url: ${{ steps.create_release.outputs.upload_url }}
155+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_arm64.zip
156+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_linux_arm64.zip
157+
asset_content_type: application/zip
158+
159+
- name: Upload netbsd_386
160+
uses: actions/upload-release-asset@v1
161+
env:
162+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
163+
with:
164+
upload_url: ${{ steps.create_release.outputs.upload_url }}
165+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_netbsd_386.zip
166+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_netbsd_386.zip
167+
asset_content_type: application/zip
168+
169+
- name: Upload netbsd_amd64
170+
uses: actions/upload-release-asset@v1
171+
env:
172+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173+
with:
174+
upload_url: ${{ steps.create_release.outputs.upload_url }}
175+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_netbsd_amd64.zip
176+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_netbsd_amd64.zip
177+
asset_content_type: application/zip
178+
179+
- name: Upload netbsd_arm
180+
uses: actions/upload-release-asset@v1
181+
env:
182+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
183+
with:
184+
upload_url: ${{ steps.create_release.outputs.upload_url }}
185+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_netbsd_arm.zip
186+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_netbsd_arm.zip
187+
asset_content_type: application/zip
188+
189+
- name: Upload openbsd_386
190+
uses: actions/upload-release-asset@v1
191+
env:
192+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
193+
with:
194+
upload_url: ${{ steps.create_release.outputs.upload_url }}
195+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_openbsd_386.zip
196+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_openbsd_386.zip
197+
asset_content_type: application/zip
198+
199+
- name: Upload openbsd_amd64
200+
uses: actions/upload-release-asset@v1
201+
env:
202+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
203+
with:
204+
upload_url: ${{ steps.create_release.outputs.upload_url }}
205+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_openbsd_amd64.zip
206+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_openbsd_amd64.zip
207+
asset_content_type: application/zip
208+
209+
- name: Upload solaris_amd64
210+
uses: actions/upload-release-asset@v1
211+
env:
212+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
213+
with:
214+
upload_url: ${{ steps.create_release.outputs.upload_url }}
215+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_solaris_amd64.zip
216+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_solaris_amd64.zip
217+
asset_content_type: application/zip
218+
219+
- name: Upload windows_386
220+
uses: actions/upload-release-asset@v1
221+
env:
222+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
223+
with:
224+
upload_url: ${{ steps.create_release.outputs.upload_url }}
225+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_windows_386.zip
226+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_windows_386.zip
227+
asset_content_type: application/zip
228+
229+
- name: Upload windows_amd64
230+
uses: actions/upload-release-asset@v1
231+
env:
232+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
233+
with:
234+
upload_url: ${{ steps.create_release.outputs.upload_url }}
235+
asset_path: ./pkg/vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_windows_amd64.zip
236+
asset_name: vault-plugin-auth-secrets_${{ steps.get_version.outputs.VERSION }}_windows_amd64.zip
237+
asset_content_type: application/zip
238+

0 commit comments

Comments
 (0)