-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (51 loc) · 1.57 KB
/
release.yaml
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
name: release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
steps:
# setup
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ">=1.20.0"
check-latest: true
- uses: nolar/setup-k3d-k3s@v1
with:
skip-creation: true
skip-readiness: true
- name: Get Version
id: get_version
run: echo "VERSION=${GITHUB_REF##*/}" >> "${GITHUB_OUTPUT}"
# run all tests
- name: Tests
run: ./test/run all
# release
- name: Run Goreleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --config=.goreleaser.yaml --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
# build and push docker image
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Build and push
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
run: |
IMAGE=docker.io/${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPOSITORY }}
echo version=$VERSION
cat docker/Dockerfile
docker build . -t $IMAGE:$VERSION -t $IMAGE:latest -f docker/Dockerfile --build-arg VERSION=$VERSION
docker push $IMAGE:$VERSION
docker push $IMAGE:latest