forked from mhl787156/starling-bake-build-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
148 lines (139 loc) · 4.83 KB
/
action.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
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
name: 'starling-bake-build'
description: 'performs the steps for a bake'
inputs:
bakefile:
description: 'Bake file path'
required: true
target:
description: 'Build Target within bake file'
required: true
tag:
description: 'Release tag'
required: true
login:
description: 'Perform Login to registry'
required: false
default: true
registry:
description: 'Registry to login to'
required: false
default: docker.io
registry_username:
description: 'Registry Username'
required: true
registry_password:
description: 'Registry Password'
required: true
build_arm64:
description: 'Set to true if building for arm64'
required: false
default: false
latest_branch:
description: 'Branch name for latest, otherwise branch name is used. Used to determine release name and caching'
required: false
default: master,main
dev_branch:
description: 'Branch name for development branch. Used to determine caching'
required: false
default: dev
push:
description: 'Push to docker hub'
required: false
default: true
load:
description: 'Load from local repository'
required: false
default: false
prefix:
description: 'Prefix to use for images'
required: false
default: uobflightlabstarling
skip_setup:
description: 'Skip the setup tests for post-test run'
required: false
default: false
outputs:
release:
description: 'Release name of the system'
value: ${{ steps.release_tag_cache.outputs.release }}
version:
description: 'Version name of the system'
value: ${{ steps.release_tag_cache.outputs.version }}
runs:
using: "composite"
steps:
- name: Checkout
if: ${{ inputs.skip_setup == 'false' }}
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Get Release tag and cache
id: release_tag_cache
shell: bash
env:
LATEST_BRANCHES: ${{ inputs.latest_branch }}
DEV_BRANCHES: ${{ inputs.dev_branch }}
TAG: ${{ inputs.tag }}
run: $GITHUB_ACTION_PATH/release_tag_cache.sh
# See https://github.com/actions/runner/issues/834#issuecomment-923177855
- uses: ChristopherHX/conditional@b4a9649204f81002ec9a4ef7d4bf7d6b2ab7fa55
if: ${{ inputs.skip_setup == 'false' }}
with:
if: ${{ inputs.build_arm64 == 'true' }}
step: |
name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: arm64
# See https://github.com/actions/runner/issues/834#issuecomment-923177855
- uses: ChristopherHX/conditional@b4a9649204f81002ec9a4ef7d4bf7d6b2ab7fa55
if: ${{ inputs.skip_setup == 'false' }}
with:
if: ${{ inputs.build_arm64 == 'false' }}
step: |
name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
if: ${{ inputs.skip_setup == 'false' }}
uses: docker/setup-buildx-action@v1
- name: Login to Registry
uses: docker/login-action@v1
if: ${{ inputs.login == 'true' }}
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.registry_username }}
password: ${{ inputs.registry_password }}
- name: If Build Local ${{ inputs.target }}
uses: docker/bake-action@master
if: ${{ inputs.load == 'true' }}
with:
files: ${{ inputs.bakefile }}
targets: ${{ inputs.target }}
push: false
load: true
set: "${{ inputs.target }}.platform=linux/amd64"
env:
BAKE_VERSION: ${{ steps.release_tag_cache.outputs.version }}
BAKE_RELEASENAME: ${{ steps.release_tag_cache.outputs.release }}
BAKE_CACHETO_NAME: ${{ inputs.skip_setup =='true' && steps.release_tag_cache.outputs.cacheto || '' }}
BAKE_CACHEFROM_NAME: ${{ steps.release_tag_cache.outputs.cachefrom }}
BAKE_REGISTRY: ${{ inputs.registry }}/
BAKE_CACHETO_REGISTRY: ${{ inputs.registry }}/
BAKE_CACHEFROM_REGISTRY: ${{ inputs.registry }}/
BAKE_PREFIX: ${{ inputs.prefix }}
- name: Build and push ${{ inputs.target }} if not local
uses: docker/bake-action@master
if: ${{ inputs.load == 'false' }}
with:
files: ${{ inputs.bakefile }}
targets: ${{ inputs.target }}
push: ${{ inputs.push }}
env:
BAKE_VERSION: ${{ steps.release_tag_cache.outputs.version }}
BAKE_RELEASENAME: ${{ steps.release_tag_cache.outputs.release }}
BAKE_CACHETO_NAME: ${{ inputs.skip_setup == 'true' && steps.release_tag_cache.outputs.cacheto || '' }}
BAKE_CACHEFROM_NAME: ${{ steps.release_tag_cache.outputs.cachefrom }}
BAKE_REGISTRY: ${{ inputs.registry }}/
BAKE_CACHETO_REGISTRY: ${{ inputs.registry }}/
BAKE_CACHEFROM_REGISTRY: ${{ inputs.registry }}/
BAKE_PREFIX: ${{ inputs.prefix }}