-
Notifications
You must be signed in to change notification settings - Fork 10
166 lines (148 loc) · 5.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
version:
name: Set Version from git ref
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- id: version
run: echo "::set-output name=version::$(sed 's#^refs/tags/\(.*\)#\1#' <<< '${{ github.ref }}')"
binaries:
name: Binaries
runs-on: ubuntu-latest
needs: version
env:
VERSION: ${{ needs.version.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_RELEASE_PAT: ${{ secrets.HOMEBREW_RELEASE_PAT }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Generate Release Notes
run: scripts/release-notes.sh $VERSION > /tmp/release-notes.md
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
args: release --clean --parallelism 5 --release-notes /tmp/release-notes.md --verbose
images:
name: Docker Images
runs-on: ubuntu-latest
needs: version
env:
VERSION: ${{ needs.version.outputs.version }}
BUILD_DATE_VAR: 'github.com/flomesh-io/fsm/pkg/version.BuildDate'
BUILD_VERSION_VAR: 'github.com/flomesh-io/fsm/pkg/version.Version'
BUILD_GITCOMMIT_VAR: 'github.com/flomesh-io/fsm/pkg/version.GitCommit'
strategy:
matrix:
id: [ "curl", "sidecar-init", "controller", "injector", "connector", "crds", "bootstrap", "preinstall", "healthcheck", "xnetmgmt", "ingress", "gateway" ]
steps:
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.RELEASE_DOCKER_USER }}
password: ${{ secrets.RELEASE_DOCKER_PASS }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Package Helm Charts
run: make charts-tgz
- name: Docker meta - ${{ matrix.id }}
id: docker_meta
uses: crazy-max/[email protected]
with:
images: ${{ secrets.RELEASE_REGISTRY }}/fsm-${{ matrix.id }}
tags: |
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=sha,format=short
flavor: |
latest=auto
- name: Get Build Info
run: |
echo "BUILD_DATE=$(date +%Y-%m-%d-%H:%M)" >> $GITHUB_ENV
echo "GIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Build and Push - ${{ matrix.id }}
uses: docker/[email protected]
with:
context: .
file: ./dockerfiles/Dockerfile.fsm-${{ matrix.id }}
platforms: linux/amd64,linux/arm64
build-args: |
GO_VERSION=1.23
LDFLAGS=-X ${{ env.BUILD_DATE_VAR }}=${{ env.BUILD_DATE }} -X ${{ env.BUILD_VERSION_VAR }}=${{ env.VERSION }} -X ${{ env.BUILD_GITCOMMIT_VAR }}=${{ env.GIT_SHA }} -s -w
DISTROLESS_TAG=nonroot
push: ${{ (github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == format('refs/heads/{0}', github.event.repository.default_branch) )) }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
demo-images:
name: Demo Docker Images
runs-on: ubuntu-latest
needs: version
strategy:
matrix:
id: [ "bookbuyer", "bookthief", "bookstore", "bookwarehouse", "tcp-echo-server", "tcp-client" ]
steps:
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.RELEASE_DOCKER_USER }}
password: ${{ secrets.RELEASE_DOCKER_PASS }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Docker meta - ${{ matrix.id }}
id: docker_meta
uses: crazy-max/[email protected]
with:
images: ${{ secrets.RELEASE_REGISTRY }}/fsm-demo-${{ matrix.id }}
tags: |
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=sha,format=short
flavor: |
latest=auto
- name: Build and Push - ${{ matrix.id }}
uses: docker/[email protected]
with:
context: .
file: ./dockerfiles/Dockerfile.demo
platforms: linux/amd64,linux/arm64
build-args: |
GO_VERSION=1.23
BINARY=${{ matrix.id }}
push: ${{ (github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == format('refs/heads/{0}', github.event.repository.default_branch) )) }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}