forked from arkavo-com/backend-go
-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (89 loc) · 2.51 KB
/
build.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
name: Build and Publish
env:
CONTAINER_ARCHS: linux/amd64,linux/arm64
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
release:
types:
- published
jobs:
version:
runs-on: ubuntu-latest
env:
RELEASE_TAG: "${{ github.event.release.tag_name}}"
outputs:
VERSION: "${{ steps.info.outputs.VERSION }}"
SHA_TAG: "${{ steps.info.outputs.SHA }}"
SERVER_TARGET: "${{ github.event_name == 'release' && 'server' || 'server-debug' }}"
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Validate releases are on main (reviewed) branch
if: github.event_name == 'release'
run: |
git fetch origin main:main
git fetch --all --tags --force
if ! git merge-base --is-ancestor "$RELEASE_TAG" main; then
echo "# Invalid release tag [$RELEASE_TAG] - must be on main" >> $GITHUB_STEP_SUMMARY
exit 1
fi
- run: |-
echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
echo "SHA=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
id: info
ci:
needs:
- version
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and test
uses: docker/build-push-action@v4
with:
context: .
platforms: "${{ env.CONTAINER_ARCHS }}"
push: false
target: tester
build-and-push:
needs:
- ci
- version
if: github.event.release
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: "${{ env.CONTAINER_ARCHS }}"
push: true
tags: ghcr.io/opentdf/gokas:${{ needs.version.outputs.VERSION }}