-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (61 loc) · 2.3 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
name: Release Pipeline
on:
push:
tags:
- 'v*.*.*' # Nur SemVer Tags (z. B. v1.0.0)
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: Install dependencies
run: go mod tidy
- name: Build Binary
run: CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -o ./output/awsserver ./cmd/server
- name: Get build architecture
id: arch
run: echo "ARCH=$(uname -m)" >> $GITHUB_ENV
- name: Package Binary
run: |
mkdir -p release
ARCH=${{ env.ARCH }}
TAR_NAME="awsserver-linux-${ARCH}.tar.gz"
tar -czvf release/${TAR_NAME} -C ./output awsserver
echo "RELEASE_FILE=release/${TAR_NAME}" >> $GITHUB_ENV
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: "Release ${{ github.ref_name }}"
draft: false
prerelease: false
body: |
## What's New in ${{ github.ref_name }}
- Static binary for Linux architecture is available as a tar.gz archive.
- Docker image is available on GitHub Packages.
**Download Binary:** [awsserver-${{ env.ARCH }}](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/awsserver-linux-${{ env.ARCH }}.tar.gz)
**Docker Image:**
`docker pull ghcr.io/${{ github.repository_owner }}/awsserver:${{ github.ref_name }}`
Enjoy!
files: ${{ env.RELEASE_FILE }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image with version tag
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/awsserver:${{ github.ref_name }}