-
Notifications
You must be signed in to change notification settings - Fork 181
82 lines (78 loc) · 2.53 KB
/
extra.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
name: Build & Push extra images
# TODO: reconsider the triggers
on:
workflow_call:
inputs:
all-versions:
type: boolean
default: false
group:
type: string
required: false
workflow_dispatch:
inputs:
all-versions:
description: Build all versions
type: boolean
default: false
group:
description: Build a specific group
type: string
required: false
# TODO: reconsider <https://github.com/github/vscode-github-actions/issues/135>
# concurrency:
# group: ${{ github.workflow }}
# cancel-in-progress: true
jobs:
generate_matrix:
runs-on: ubuntu-latest
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/[email protected]
- id: set-matrix
run: |
JSON="build/matrix/latest.json"
if [[ "${{ inputs.all-versions }}" == "true" ]]; then
JSON="build/matrix/latest-two.json"
fi
if [[ -z "${{ inputs.group }}" ]]; then
CONTENT="$(jq -s -r '.[0] + { group: [.[1].group[] | keys[] | select(. != "default")] } | tostring' $JSON build/templates/bakefiles/extra.docker-bake.json)"
else
CONTENT="$(jq -r '.group = ["${{ inputs.group }}"] | tostring' $JSON)"
fi
echo "matrix=${CONTENT}" >>"$GITHUB_OUTPUT"
echo "${CONTENT}"
build:
needs: generate_matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate_matrix.outputs.matrix)}}
steps:
- uses: actions/[email protected]
- name: Clean up
run: |
docker image prune --all --force
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker images
run: |
BAKE_JSON=bakefiles/${{ matrix.r_version }}.extra.docker-bake.json \
BAKE_GROUP=${{ matrix.group }} \
BAKE_OPTION=--push \
make bake-json-group