-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (75 loc) · 2.27 KB
/
build.yml
File metadata and controls
83 lines (75 loc) · 2.27 KB
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
name: Build and Test
on:
push:
tags:
- v*
branches:
- develop
- main
pull_request:
permissions:
contents: read
pull-requests: read
env:
__W_SRC_REL: go/src/github.com/RocketChat/airlock
jobs:
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
path: ${{ env.__W_SRC_REL }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ${{ env.__W_SRC_REL }}/go.mod
- name: Build binary
run: |
cd $__W_SRC_REL
go mod tidy
platform=${{ matrix.platform }}
TARGETOS=${platform%%/*} TARGETARCH=${platform##*/} make build
- name: Set up QEMU
if: ${{ matrix.platform == 'linux/arm64' }}
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: ${{ matrix.platform == 'linux/arm64' }}
uses: docker/setup-buildx-action@v3
- name: Tag arch images
id: tag
run: |
platform=${{ matrix.platform}}
echo "tag=${platform##*/}" >> $GITHUB_OUTPUT
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERREGISTRY_USERNAME }}
password: ${{ secrets.DOCKERREGISTRY_PASSWORD }}
- name: Docker build and push
uses: docker/build-push-action@v3
with:
context: ${{ env.__W_SRC_REL }}
file: ${{ env.__W_SRC_REL }}/Dockerfile
platforms: ${{ matrix.platform }}
push: true
tags: |
rocketchat/airlock:${{github.sha}}-${{ steps.tag.outputs.tag }}
combine-arch-tags:
needs: [build]
name: Join platform tags
runs-on: ubuntu-latest
steps:
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERREGISTRY_USERNAME }}
password: ${{ secrets.DOCKERREGISTRY_PASSWORD }}
- name: Join tags and push
run: |
docker buildx imagetools create -t rocketchat/airlock:${{ github.sha }} rocketchat/airlock:${{ github.sha }}-amd64 rocketchat/airlock:${{ github.sha }}-arm64