-
Notifications
You must be signed in to change notification settings - Fork 545
101 lines (89 loc) · 2.45 KB
/
release.yaml
File metadata and controls
101 lines (89 loc) · 2.45 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: release
on:
push:
branches:
- main
tags:
- "v*"
jobs:
build-docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout code
uses: actions/checkout@v6
- run: |
echo "GIT_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Docker meta
id: docker_meta
uses: docker/metadata-action@v6.0.0
with:
images: |
ghcr.io/tus/tusd
tusproject/tusd
tags: |
type=sha
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v4.0.0
with:
install: true
-
name: Login to GitHub Container Registry
uses: docker/login-action@v4.0.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
-
name: Login to Docker Container Registry
uses: docker/login-action@v4.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
id: build
uses: docker/build-push-action@v7
with:
push: true
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha
build-args: |
GIT_VERSION=${{ env.GIT_VERSION }}
GIT_COMMIT=${{ github.sha }}
platforms: linux/amd64,linux/arm64/v8
build-binary:
runs-on: ubuntu-latest
permissions:
# Required for gh release create / gh release upload
contents: write
steps:
-
name: Checkout code
uses: actions/checkout@v6
-
name: Install Go
uses: actions/setup-go@v6
with:
go-version: 'stable'
-
name: Build TUSD
run: ./scripts/build_all.sh
-
name: GitHub Release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="${GITHUB_REF#refs/tags/}"
gh release create "$TAG" --title "$TAG" --generate-notes || true
gh release upload "$TAG" tusd_*.* --clobber