-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 2.02 KB
/
build-and-push.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
name: Docker Build and Push
on:
push:
branches:
- main
tags:
- '*'
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v5
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
if: startsWith(github.ref, 'refs/tags/')
with:
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref_name }}
GIT_COMMIT: ${{ github.sha }}
BUILD_DATE: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker build and push
run: |
docker buildx build \
--platform linux/amd64 \
--pull \
--build-arg VERSION=${{ github.ref_name }} \
--build-arg GIT_COMMIT=${{ github.sha }} \
--build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--cache-from supporttools/gokubebalancer:latest \
-t supporttools/gokubebalancer:"${{ github.ref_name }}" \
-t supporttools/gokubebalancer:latest \
--push \
-f Dockerfile .
- name: Install Snapcraft
run: sudo snap install snapcraft --classic
- name: Build Snap package
run: |
# Update the version in snapcraft.yaml
sed -i "s/version: '.*'/version: '${{ github.ref_name }}'/g" snapcraft.yaml
snapcraft pack
# - name: Publish Snap package
# env:
# SNAPCRAFT_LOGIN: ${{ secrets.SNAPCRAFT_LOGIN }}
# run: |
# snapcraft login --with $SNAPCRAFT_LOGIN
# snapcraft upload gokubebalancer_*.snap --release=edge