forked from TykTechnologies/tyk-identity-broker
-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (155 loc) · 4.88 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
# Generated by: gromit policy
# Generated on: Fri Apr 28 10:48:32 UTC 2023
# Distribution channels covered by this workflow
# - docker hub
name: Release
on:
pull_request:
push:
branches:
- master
- release-**
tags:
- 'v*'
env:
GOPRIVATE: github.com/TykTechnologies
REGISTRY: ghcr.io
jobs:
goreleaser:
name: '${{ matrix.golang_cross }}'
runs-on: ubuntu-latest
container: 'tykio/golang-cross:${{ matrix.golang_cross }}'
strategy:
fail-fast: false
matrix:
golang_cross: [1.19-bullseye]
include:
- golang_cross: 1.19-bullseye
goreleaser: 'ci/goreleaser/goreleaser.yml'
debvers: 'ubuntu/xenial ubuntu/bionic debian/jessie ubuntu/focal debian/buster debian/bullseye'
outputs:
tag: ${{ steps.targets.outputs.tag }}
steps:
- name: Fix private module deps
env:
TOKEN: '${{ secrets.ORG_GH_TOKEN }}'
run: >
git config --global url."https://${TOKEN}@github.com".insteadOf "https://github.com"
- name: Checkout of tyk-identity-broker
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: "Add Git safe.directory"
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Delete old release assets
if: startsWith(github.ref, 'refs/tags')
uses: mknejp/delete-release-assets@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref }}
fail-if-no-assets: false
fail-if-no-release: false
assets: |
*.deb
*.rpm
*.tar.gz
*.txt.sig
*.txt
- name: Set tag
id: targets
shell: bash
run: |
current_tag=${GITHUB_REF##*/}
echo "tag=${current_tag}" >> $GITHUB_OUTPUT
- uses: goreleaser/goreleaser-action@v4
with:
version: 1.18.2
args: release --clean -f ${{ matrix.goreleaser }} ${{ !startsWith(github.ref, 'refs/tags/') && ' --snapshot' || '' }}
env:
CGO_ENABLED: 0
GOLANG_CROSS: ${{ matrix.golang_cross }}
DEBVERS: ${{ matrix.debvers }}
- uses: actions/upload-artifact@v3
with:
name: deb
retention-days: 1
path: |
dist/*.deb
!dist/*PAYG*.deb
ci:
needs:
- goreleaser
runs-on: ubuntu-latest
steps:
- name: Shallow checkout of tyk-identity-broker
uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/download-artifact@v3
with:
name: deb
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Login to GithHub Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: CI build
uses: docker/build-push-action@v3
with:
push: true
context: "."
file: ci/Dockerfile.std
platforms: linux/amd64,linux/arm64
tags: |
${{ env.REGISTRY }}/sycatims/sycat-one-identity-broker:${{ needs.goreleaser.outputs.tag }}
${{ env.REGISTRY }}/sycatims/sycat-one-identity-broker:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
# - name: Tell gromit about new build
# id: gromit
# run: |
# # Remember to remove the true when TD-626 is fixed
# curl -fsSL -H "Authorization: ${{secrets.GROMIT_TOKEN}}" 'https://domu-kun.cloud.tyk.io/gromit/newbuild' \
# -X POST -d '{ "repo": "${{ github.repository}}", "ref": "${{ github.ref }}", "sha": "${{ github.sha }}" }' || true
#
smoke-tests:
if: startsWith(github.ref, 'refs/tags') && !github.event.pull_request.draft
needs:
- goreleaser
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Run tests
shell: bash
run: |
set -eaxo pipefail
if [ ! -d smoke-tests ]; then
echo "::warning No repo specific smoke tests defined"
fi
if [ ! -d ci/tests ]; then
echo "::warning No ci tests defined"
exit 0
fi
for d in ci/tests/*/
do
echo Attempting to test $d
if [ -d $d ] && [ -e $d/test.sh ]; then
cd $d
./test.sh ${{ needs.goreleaser.outputs.tag }}
cd -
fi
done
for d in smoke-tests/*/
do
echo Attempting to test $d
if [ -d $d ] && [ -e $d/test.sh ]; then
cd $d
./test.sh ${{ needs.goreleaser.outputs.tag }}
cd -
fi
done