Skip to content

Commit a29894e

Browse files
committed
Add release workflow
1 parent 5cfb56c commit a29894e

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.github/workflows/release.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
DOCKER_IMAGE: leocomelli/secrets-init
10+
11+
jobs:
12+
test-build:
13+
name: Create Release
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: set up golang
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: '1.17.5'
21+
22+
- name: checkout
23+
uses: actions/checkout@v2
24+
25+
- name: golangci lint
26+
uses: golangci/golangci-lint-action@v2
27+
28+
- name: testing
29+
run: make test
30+
31+
- name: build
32+
run: make build
33+
34+
- name: create release
35+
uses: actions/create-release@v1
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
38+
with:
39+
tag_name: ${{ github.ref }}
40+
release_name: ${{ github.ref }}
41+
draft: false
42+
prerelease: false
43+
44+
- name: github release
45+
uses: softprops/action-gh-release@v1
46+
with:
47+
draft: true
48+
files: |
49+
dist/secrets-init_linux-amd64
50+
name: ${{ github.ref }}
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
53+
54+
- name: set up docker buildx
55+
uses: docker/setup-buildx-action@v1
56+
57+
- name: dockerhub login
58+
uses: docker/login-action@v1
59+
if: success()
60+
with:
61+
username: ${{ secrets.DOCKER_USERNAME }}
62+
password: ${{ secrets.DOCKER_PASSWORD }}
63+
64+
- name: get tag
65+
id: tag
66+
uses: dawidd6/action-get-tag@v1
67+
with:
68+
strip_v: true
69+
70+
- name: build and push
71+
uses: docker/build-push-action@v2
72+
with:
73+
context: .
74+
push: true
75+
tags: ${{ env.DOCKER_IMAGE }}:latest,${{ env.DOCKER_IMAGE }}:${{steps.tag.outputs.tag}}
76+

0 commit comments

Comments
 (0)