forked from evryfs/github-actions-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (72 loc) · 2.46 KB
/
nubis-meta.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
name: build
on:
push:
branches:
- nubis-runners
workflow_dispatch:
env:
# Use docker.io for Docker Hub if empty
#REGISTRY: docker.io
REGISTRY: harbor.nbfc.io/nubificus
# github.repository as <account>/<repo>
IMAGE_NAME: gh-actions-runner-gcc-lite
# IMAGE_NAME: ${{ github.repository }}
#IMAGE_NAME: ananos/${{ github.repository }}
jobs:
prepare:
name: Generate matrix for build
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
matrix2: ${{ steps.set-matrix.outputs.matrix2 }}
myvars: ${{ steps.set-matrix.outputs.myvars }}
files: ${{ steps.set-matrix.outputs.files}}
arch: ${{ steps.set-matrix.outputs.arch}}
registry: ${{ steps.dockerfiles.outputs.registry }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check files
id: dockerfiles
run: |
export dockerfiles=$( ls -1 Dockerfile.* )
echo "$dockerfiles"
# Escape newlines (replace \n with %0A)
echo "::set-output name=dockerfiles::$( echo "$dockerfiles" | sed ':a;N;$!ba;s/\n/%0A/g' )"
echo "registry=${{ env.REGISTRY }}" >> "$GITHUB_OUTPUT"
- name: Set matrix for build
id: set-matrix
run: |
dockerfiles="${{ steps.dockerfiles.outputs.dockerfiles }}"
JSON="{\"dockerfile\":["
# Loop by lines
while read path; do
# Add item to the matrix only if it is not already included and remove /
path=${path}
JSONline="\"$path\","
if [[ "$JSON" != *"$JSONline"* ]]; then
JSON="$JSON$JSONline"
fi
done <<< "$dockerfiles"
if [[ $JSON == *, ]]; then
JSON="${JSON%?}"
fi
JSON="$JSON], \"architecture\":[\"x86_64\", \"aarch64\"]}"
echo $JSON
# Set output
echo "::set-output name=matrix::$( echo "$JSON" )"
build:
needs: [prepare]
uses: ./.github/workflows/nubis-build.yaml
secrets: inherit
strategy:
matrix:
dockerfiles: ${{ fromJson(toJSON(fromJson(needs.prepare.outputs.matrix).dockerfile)) }}
fail-fast: false
with:
matrix: ${{ needs.prepare.outputs.matrix }}
#dockerfile: ${{ toJSON(fromJson(needs.prepare.outputs.matrix).dockerfile) }}
dockerfile: ${{ matrix.dockerfiles }}
registry: ${{ needs.prepare.outputs.registry }}