-
-
Notifications
You must be signed in to change notification settings - Fork 23
156 lines (137 loc) · 4.19 KB
/
tag.yaml
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
name: Test/Build/Push (tag)
on:
push:
tags:
- '*'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [ '1.20' ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go_version }}
- name: Install go dependencies & run tests
shell: script -q -e -c "bash {0}"
run: |
export TERM=xterm
cd backend
go test -v -cover -race ./...
docker-build-push-standalone:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker buildx available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Get the version
id: get_version
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//}
- name: Run docker buildx build
run: |
docker buildx build \
-f Dockerfile.standalone \
--build-arg Version=${{ github.ref }} \
--platform linux/amd64 \
--output=type=registry \
--tag ekofr/authz:${{ steps.get_version.outputs.TAG_NAME }}-standalone \
.
docker-build-push:
strategy:
matrix:
directory: ['backend', 'frontend']
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up docker buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v3
with:
buildx-version: latest
qemu-version: latest
- name: Docker buildx available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Get the version
id: get_version
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//}
- name: Run docker buildx build
run: |
cd ${{ matrix.directory }}
docker buildx build \
--build-arg Version=${{ github.ref }} \
--platform linux/amd64 \
--output=type=registry \
--tag ekofr/authz:${{ steps.get_version.outputs.TAG_NAME }}-${{ matrix.directory }} \
.
release:
runs-on: ubuntu-latest
needs: test
steps:
- name: Create release
id: create
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
outputs:
upload_url: ${{ steps.create.outputs.upload_url }}
upload-binaries:
needs: release
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: 386
- os: ubuntu-latest
goos: linux
goarch: amd64
- os: ubuntu-latest
goos: linux
goarch: arm
- os: macos-latest
goos: darwin
goarch: amd64
- os: macos-latest
goos: darwin
goarch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Create release
run: |
cd backend
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-s -w -X main.Version=${{ github.ref }}" -o authz-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd
- name: Upload release assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./backend/authz-${{ matrix.goos }}-${{ matrix.goarch }}
asset_name: authz-${{ matrix.goos }}-${{ matrix.goarch }}
asset_content_type: application/octet-stream