forked from flipt-io/flipt
-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (156 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
packages: write
env:
GO_VERSION: "1.22"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: linux
- os: macos-latest
name: darwin
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- uses: actions/cache@v4
with:
path: _tools/
key: ${{ runner.os }}-go-tools${{ hashFiles('_tools/go.sum') }}
restore-keys: |
${{ runner.os }}-go-tools-
- uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install GCC for arm64
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update && \
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Install Quill
if: matrix.os == 'macos-latest'
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b $GITHUB_WORKSPACE/bin
echo "${GITHUB_WORKSPACE}/bin" >> $GITHUB_PATH
- name: Install Mage
uses: magefile/mage-action@v3
with:
# mac build currently doesn't exist for v1.15.0 https://github.com/magefile/mage/issues/481
version: v1.14.0
install-only: true
- name: Prep Build
run: mage prep
env:
FLIPT_FORMBRICKS_ENVIRONMENT_ID: ${{ secrets.FLIPT_FORMBRICKS_ENVIRONMENT_ID }}
- name: GoReleaser Build
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: build --clean -f .goreleaser.${{ matrix.name }}.yml
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANALYTICS_WRITE_KEY: ${{ secrets.ANALYTICS_WRITE_KEY }}
ANALYTICS_WRITE_ENDPOINT: ${{ secrets.ANALYTICS_WRITE_ENDPOINT }}
QUILL_SIGN_P12: ${{ secrets.QUILL_SIGN_P12 }}
QUILL_SIGN_PASSWORD: ${{ secrets.QUILL_SIGN_PASSWORD }}
- uses: actions/upload-artifact@v4
with:
name: flipt-${{ matrix.name }}
path: dist/flipt_${{ matrix.name }}_*/flipt
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: actions/download-artifact@v4
with:
name: flipt-linux
path: tmp/dist
- uses: actions/download-artifact@v4
with:
name: flipt-darwin
path: tmp/dist
- name: Install Skopeo
run: |
sudo apt-get update
sudo apt-get -y install skopeo
- name: Install Syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "${{ github.repository_owner }}"
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.FLIPT_RELEASE_BOT_APP_ID }}
private_key: ${{ secrets.FLIPT_RELEASE_BOT_APP_PEM }}
installation_id: ${{ secrets.FLIPT_RELEASE_BOT_INSTALLATION_ID }}
- name: GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: release --clean
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
ANALYTICS_WRITE_KEY: ${{ secrets.ANALYTICS_WRITE_KEY }}
ANALYTICS_WRITE_ENDPOINT: ${{ secrets.ANALYTICS_WRITE_ENDPOINT }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }}
DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
- name: Install Mage
uses: magefile/mage-action@v3
with:
install-only: true
# TODO: see if we can wire up the `release-tag-latest` workflow to run
# after release with the same tag
- name: Tag and Push latest
env:
TAG: ${{ github.ref_name }}
run: |
cd build
if [[ $TAG == $(mage release:latest go.flipt.io/flipt) ]]; then
docker pull flipt/flipt:$TAG
skopeo copy --all docker://flipt/flipt:$TAG docker://flipt/flipt:latest
docker pull markphelps/flipt:$TAG
skopeo copy --all docker://markphelps/flipt:$TAG docker://markphelps/flipt:latest
docker pull ghcr.io/flipt-io/flipt:$TAG
skopeo copy --all docker://ghcr.io/flipt-io/flipt:$TAG docker://ghcr.io/flipt-io/flipt:latest
fi