Skip to content

Commit 22e5529

Browse files
authored
feat: Add workflow separation; add workflow_call (#54)
1 parent 6ae8908 commit 22e5529

File tree

2 files changed

+76
-50
lines changed

2 files changed

+76
-50
lines changed

.github/workflows/main.yaml

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ on:
1919

2020
jobs:
2121
docker-image-build:
22-
runs-on: ubuntu-latest
2322
permissions:
2423
contents: read
2524
packages: write
@@ -28,59 +27,16 @@ jobs:
2827
strategy:
2928
fail-fast: true
3029
matrix:
31-
image:
30+
operating-system-base:
3231
- ubuntu-2204-lts
3332
gap-build:
3433
- bare
3534
- full
3635
gap-version:
3736
- 4.14.0
3837
- 4.13.1
39-
40-
steps:
41-
- name: 👨‍💻 git -- checkout
42-
uses: actions/checkout@v4
43-
44-
- name: 🐬 docker -- metadata
45-
id: meta
46-
uses: docker/metadata-action@v5
47-
with:
48-
images: |
49-
name=ghcr.io/${{ github.repository }}
50-
tags: |
51-
type=sha
52-
type=raw,value=${{ matrix.gap-version }}-${{ matrix.gap-build }}
53-
54-
55-
- name: 📦 docker -- login to ghcr-registry
56-
uses: docker/login-action@v3
57-
with:
58-
registry: ghcr.io
59-
username: ${{ github.actor }}
60-
password: ${{ secrets.GITHUB_TOKEN }}
61-
62-
- name: 💻 quemu -- setup
63-
uses: docker/setup-qemu-action@v3
64-
65-
- name: 🐬 docker -- setup buildx
66-
uses: docker/setup-buildx-action@v3
67-
with:
68-
install: true
69-
driver-opts: |
70-
image=moby/buildkit:master
71-
network=host
72-
73-
- name: 🐬 docker -- build and push
74-
uses: docker/build-push-action@v6
75-
with:
76-
context: ./src/dockerfiles/${{ matrix.image }}
77-
file: ./src/dockerfiles/${{ matrix.image }}/Dockerfile
78-
push: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
79-
tags: ${{ steps.meta.outputs.tags }}
80-
labels: ${{ steps.meta.outputs.labels }}
81-
target: ${{ matrix.gap-build }}
82-
platforms: linux/amd64,linux/arm64
83-
cache-from: type=gha
84-
cache-to: type=gha,mode=max`
85-
build-args: |
86-
GAP_VERSION=${{ matrix.gap-version }}
38+
uses: ./.github/workflows/worflow-dispatch-build.yaml
39+
with:
40+
gap-version: ${{ matrix.gap-version }}
41+
gap-build: ${{ matrix.gap-build }}
42+
operating-system-base: ${{ matrix.operating-system-base }}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Docker - build and publish image
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
gap-version:
7+
required: true
8+
type: string
9+
gap-build:
10+
required: true
11+
type: string
12+
operating-system-base:
13+
required: true
14+
type: string
15+
16+
jobs:
17+
docker-image-build:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
attestations: write
23+
id-token: write
24+
steps:
25+
- name: 👨‍💻 git -- checkout
26+
uses: actions/checkout@v4
27+
28+
- name: 🐬 docker -- metadata
29+
id: meta
30+
uses: docker/metadata-action@v5
31+
with:
32+
images: |
33+
name=ghcr.io/${{ github.repository }}
34+
tags: |
35+
type=sha
36+
type=raw,value=${{ inputs.gap-version }}-${{ inputs.gap-build }}
37+
38+
39+
- name: 📦 docker -- login to ghcr-registry
40+
uses: docker/login-action@v3
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: 💻 quemu -- setup
47+
uses: docker/setup-qemu-action@v3
48+
49+
- name: 🐬 docker -- setup buildx
50+
uses: docker/setup-buildx-action@v3
51+
with:
52+
install: true
53+
driver-opts: |
54+
image=moby/buildkit:master
55+
network=host
56+
57+
- name: 🐬 docker -- build and push
58+
uses: docker/build-push-action@v6
59+
with:
60+
context: ./src/dockerfiles/${{ inputs.operating-system-base }}
61+
file: ./src/dockerfiles/${{ inputs.operating-system-base }}/Dockerfile
62+
push: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
63+
tags: ${{ steps.meta.outputs.tags }}
64+
labels: ${{ steps.meta.outputs.labels }}
65+
target: ${{ inputs.gap-build }}
66+
platforms: linux/amd64,linux/arm64
67+
cache-from: type=gha
68+
cache-to: type=gha,mode=max`
69+
build-args: |
70+
GAP_VERSION=${{ inputs.gap-version }}

0 commit comments

Comments
 (0)