-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (93 loc) · 2.91 KB
/
server-release.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
name: Server - release
on:
workflow_dispatch:
push:
branches: [ release ]
paths:
- "diode-server/**"
- "!diode-server/docker/**"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
env:
GH_TOKEN: ${{ secrets.ORB_CI_GH_TOKEN }}
SEMANTIC_RELEASE_PACKAGE: ${{ github.repository }}
GO_VERSION: '1.22'
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
apps: ${{ steps.apps.outputs.apps }}
steps:
- name: Get apps
id: apps
run: |
echo 'apps=["ingester", "reconciler"]' >> "$GITHUB_OUTPUT"
get-next-version:
name: Get next version - ${{ matrix.app }}
needs: [ setup ]
uses: netboxlabs/diode/.github/workflows/reusable_semantic_release_get_next_version.yaml@develop
strategy:
fail-fast: false
matrix:
app: ${{ fromJSON(needs.setup.outputs.apps) }}
with:
app_name: diode-${{ matrix.app }}
app_dir: diode-server
secrets: inherit
build:
name: Build - ${{ matrix.app }}
needs: [ setup, get-next-version ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
app: ${{ fromJSON(needs.setup.outputs.apps) }}
if: needs.get-next-version.outputs.new-release-published == 'true'
env:
BUILD_VERSION: ${{ needs.get-next-version.outputs.new-release-version }}
BUILD_COMMIT: ${{ needs.get-next-version.outputs.short-sha }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set build info
run: |
echo $BUILD_COMMIT > ./diode-server/version/BUILD_COMMIT.txt
echo $BUILD_VERSION > ./diode-server/version/BUILD_VERSION.txt
- name: Build image and push
uses: docker/build-push-action@v6
with:
context: diode-server
file: diode-server/docker/Dockerfile-build
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
netboxlabs/diode-${{ matrix.app }}:latest
netboxlabs/diode-${{ matrix.app }}:${{ env.BUILD_VERSION }}
build-args: |
GO_VERSION=${{ env.GO_VERSION }}
SVC=${{ matrix.app }}
semantic-release:
name: Semantic release - ${{ matrix.app }}
uses: netboxlabs/diode/.github/workflows/reusable_semantic_release.yaml@develop
needs: [ setup, build ]
strategy:
fail-fast: false
matrix:
app: ${{ fromJSON(needs.setup.outputs.apps) }}
with:
app_name: diode-${{ matrix.app }}
app_dir: diode-server
secrets: inherit