-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (67 loc) · 2.43 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
name: Release
on:
push:
branches:
- 'main'
permissions:
contents: write
packages: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get next version
id: get_next_version
uses: thenativeweb/[email protected]
- name: Setup Go
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Setup Git user
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Create new tag
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
run: |
next_version=${{ steps.get_next_version.outputs.version }}
git tag $next_version
git push origin $next_version
- name: Build for platforms
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
run: make build-all
- name: Release binaries
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
uses: ncipollo/release-action@v1
with:
artifacts: "build/*"
tag: ${{ steps.get_next_version.outputs.version }}
- name: Set up QEMU
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
uses: docker/setup-buildx-action@v3
- name: Login to GitHub container registry
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: github-actions
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
uses: docker/build-push-action@v6
env:
DOCKER_REPOSITORY: ghcr.io/${{ github.repository }}
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.DOCKER_REPOSITORY }}:latest,${{ env.DOCKER_REPOSITORY }}:${{steps.get_next_version.outputs.version}}