-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (83 loc) · 2.45 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Release
on:
workflow_dispatch:
inputs:
goreleaser:
description: Create Github release artifacts
required: true
type: boolean
releaseType:
description: Release type
required: true
type: choice
options: [dev, release]
env:
GO_VERSION: "1.21"
jobs:
goreleaser:
name: Create Github release
runs-on: ubuntu-latest
if: github.event.inputs.releaseType == 'release' && github.event.inputs.goreleaser
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker:
name: Build Docker images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64/v8
- name: Setup buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/digineo/texd
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}
latest
- name: Release meta
uses: actions/github-script@v7
id: release-meta
with:
script: |
const isRelease = context.payload.inputs.releaseType === 'release' ? '1' : '0'
return { isRelease }
- name: Docker image
uses: docker/build-push-action@v5
with:
file: ./.github/Dockerfile.release
build-args: |
GO_VERSION=${{ env.GO_VERSION }}
IS_RELEASE=${{ steps.release-meta.outputs.result.isRelease }}
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: .