-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (116 loc) · 3.79 KB
/
build-test-and-publish.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
name: Build, test, and publish
on:
workflow_dispatch:
inputs:
distribution:
description: 'The distribution to build'
required: true
default: '["run"]'
options:
- '["run"]'
- '["tomcat"]'
- '["run", "tomcat"]'
platform:
description: 'The platform to build for'
required: true
default: '["amd64"]'
options:
- '["amd64"]'
- '["arm64"]'
- '["amd64", "arm64"]'
version:
description: 'The version to build'
required: false
default: '1.0.0-beta-3'
snapshot:
description: 'Build a snapshot version'
type: boolean
required: false
default: true
release:
repositories:
- 'operaton/operaton'
types: [published]
jobs:
build-and-test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
DISTRO: ${{ fromJson(github.event.inputs.distribution || '["run", "tomcat"]') }}
PLATFORM: ${{ fromJson(github.event.inputs.platform || '["amd64", "arm64"]') }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: ${{ matrix.PLATFORM != 'amd64' }}
with:
platforms: ${{ matrix.PLATFORM }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Expose GitHub Runtime
uses: actions/github-script@v7
with:
script: |
Object.keys(process.env).forEach(function (key) {
if (key.startsWith('ACTIONS_')) {
core.info(`${key}=${process.env[key]}`);
core.exportVariable(key, process.env[key]);
}
});
- name: Build
run: ./pipeline.sh
env:
DISTRO: ${{ matrix.DISTRO }}
PLATFORM: ${{ matrix.PLATFORM }}
VERSION: ${{ github.event.inputs.version || '' }}
SNAPSHOT: ${{ github.event.inputs.snapshot || '' }}
IMAGE_REPO_OPERATON: ${{ vars.IMAGE_REPO_OPERATON }}
IMAGE_REPO_TOMCAT: ${{ vars.IMAGE_REPO_TOMCAT }}
- name: Test
run: ./test.sh
working-directory: test
env:
DISTRO: ${{ matrix.DISTRO }}
PLATFORM: ${{ matrix.PLATFORM }}
VERSION: ${{ github.event.inputs.version || '' }}
SNAPSHOT: ${{ github.event.inputs.snapshot || '' }}
IMAGE_REPO_OPERATON: ${{ vars.IMAGE_REPO_OPERATON }}
IMAGE_REPO_TOMCAT: ${{ vars.IMAGE_REPO_TOMCAT }}
publish:
runs-on: ubuntu-20.04
needs: build-and-test
strategy:
matrix:
DISTRO: [run, tomcat]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64,amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Expose GitHub Runtime
uses: actions/github-script@v7
with:
script: |
Object.keys(process.env).forEach(function (key) {
if (key.startsWith('ACTIONS_')) {
core.info(`${key}=${process.env[key]}`);
core.exportVariable(key, process.env[key]);
}
});
- name: Publish multi-platform images
run: ./release.sh
env:
DISTRO: ${{ matrix.DISTRO }}
PLATFORMS: linux/arm64,linux/amd64
VERSION: ${{ github.event.inputs.version || '' }}
SNAPSHOT: ${{ github.event.inputs.snapshot || '' }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
IMAGE_REPO_OPERATON: ${{ vars.IMAGE_REPO_OPERATON }}
IMAGE_REPO_TOMCAT: ${{ vars.IMAGE_REPO_TOMCAT }}