- commit
- 1afa8e3
- parent
- 0e7eac3
- author
- Antonio Mika
- date
- 2023-11-09 00:07:37 +0000 UTC
Refactor actions for matrix builds
3 files changed,
+51,
-40
+14,
-0
1@@ -16,6 +16,14 @@ inputs:
2 description: The docker registry to use
3 required: false
4 default: ghcr.io
5+ web:
6+ description: Whether or not to build the web image
7+ required: false
8+ default: true
9+ ssh:
10+ description: Whether or not to build the ssh image
11+ required: false
12+ default: true
13
14 runs:
15 using: composite
16@@ -31,6 +39,7 @@ runs:
17 with:
18 images: ${{ inputs.REGISTRY }}/${{ github.repository }}/${{ inputs.app }}-ssh
19 - name: Build and push web
20+ if: inputs.web
21 uses: docker/build-push-action@v3
22 with:
23 context: .
24@@ -39,9 +48,12 @@ runs:
25 labels: ${{ steps.webmeta.outputs.labels }}
26 target: release-web
27 platforms: ${{ inputs.platforms }}
28+ cache-from: type=gha
29+ cache-to: type=gha,mode=max
30 build-args: |
31 APP=${{ inputs.app }}
32 - name: Build and push ssh
33+ if: inputs.ssh
34 uses: docker/build-push-action@v3
35 with:
36 context: .
37@@ -50,5 +62,7 @@ runs:
38 labels: ${{ steps.sshmeta.outputs.labels }}
39 target: release-ssh
40 platforms: ${{ inputs.platforms }}
41+ cache-from: type=gha
42+ cache-to: type=gha,mode=max
43 build-args: |
44 APP=${{ inputs.app }}
+35,
-38
1@@ -39,9 +39,12 @@ jobs:
2 run: |
3 go test -v ./... -cover -race -coverprofile=coverage.out
4 go tool cover -func=coverage.out -o=coverage.out
5- build:
6+ build-main:
7 runs-on: ubuntu-22.04
8 needs: test
9+ strategy:
10+ matrix:
11+ APP: [lists, prose, pastes, imgs, pgs, feeds]
12 steps:
13 - name: Checkout repo
14 uses: actions/checkout@v3
15@@ -60,43 +63,13 @@ jobs:
16 registry: ${{ env.REGISTRY }}
17 username: ${{ github.actor }}
18 password: ${{ secrets.GITHUB_TOKEN }}
19- - name: Run docker build for lists
20+ - name: Run docker build for ${{ matrix.APP }}
21 uses: ./.github/actions/build
22 with:
23- app: lists
24+ app: ${{ matrix.APP }}
25 platforms: ${{ env.PLATFORMS }}
26 registry: ${{ env.REGISTRY }}
27- - name: Run docker build for prose
28- uses: ./.github/actions/build
29- with:
30- app: prose
31- platforms: ${{ env.PLATFORMS }}
32- registry: ${{ env.REGISTRY }}
33- - name: Run docker build for pastes
34- uses: ./.github/actions/build
35- with:
36- app: pastes
37- platforms: ${{ env.PLATFORMS }}
38- registry: ${{ env.REGISTRY }}
39- - name: Run docker build for imgs
40- uses: ./.github/actions/build
41- with:
42- app: imgs
43- platforms: ${{ env.PLATFORMS }}
44- registry: ${{ env.REGISTRY }}
45- - name: Run docker build for pgs
46- uses: ./.github/actions/build
47- with:
48- app: pgs
49- platforms: ${{ env.PLATFORMS }}
50- registry: ${{ env.REGISTRY }}
51- - name: Run docker build for feeds
52- uses: ./.github/actions/build
53- with:
54- app: feeds
55- platforms: ${{ env.PLATFORMS }}
56- registry: ${{ env.REGISTRY }}
57- build-caddy:
58+ build-misc:
59 runs-on: ubuntu-22.04
60 needs: test
61 steps:
62@@ -117,8 +90,30 @@ jobs:
63 registry: ${{ env.REGISTRY }}
64 username: ${{ github.actor }}
65 password: ${{ secrets.GITHUB_TOKEN }}
66- - name: Collect image metadata
67- id: meta
68+ - name: Run docker build for auth
69+ uses: ./.github/actions/build
70+ with:
71+ app: auth
72+ platforms: ${{ env.PLATFORMS }}
73+ registry: ${{ env.REGISTRY }}
74+ ssh: false
75+ - name: Collect bouncer image metadata
76+ id: bouncermeta
77+ uses: docker/metadata-action@v4
78+ with:
79+ images: ${{ env.REGISTRY }}/${{ github.repository }}/bouncer
80+ - name: Build and push
81+ uses: docker/build-push-action@v3
82+ with:
83+ context: ./bouncer
84+ push: true
85+ tags: ${{ steps.bouncermeta.outputs.tags }}
86+ labels: ${{ steps.bouncermeta.outputs.labels }}
87+ platforms: ${{ env.PLATFORMS }}
88+ cache-from: type=gha
89+ cache-to: type=gha,mode=max
90+ - name: Collect caddy image metadata
91+ id: caddymeta
92 uses: docker/metadata-action@v4
93 with:
94 images: ${{ env.REGISTRY }}/${{ github.repository }}/caddy
95@@ -127,6 +122,8 @@ jobs:
96 with:
97 context: ./caddy
98 push: true
99- tags: ${{ steps.meta.outputs.tags }}
100- labels: ${{ steps.meta.outputs.labels }}
101+ tags: ${{ steps.caddymeta.outputs.tags }}
102+ labels: ${{ steps.caddymeta.outputs.labels }}
103 platforms: ${{ env.PLATFORMS }}
104+ cache-from: type=gha
105+ cache-to: type=gha,mode=max
M
Makefile
+2,
-2
1@@ -30,7 +30,7 @@ bp-setup:
2 .PHONY: bp-setup
3
4 bp-caddy: bp-setup
5- $(DOCKER_BUILDX_BUILD) -t ghcr.io/picosh/pico/caddy:$(DOCKER_TAG) -f caddy/Dockerfile .
6+ $(DOCKER_BUILDX_BUILD) -t ghcr.io/picosh/pico/caddy:$(DOCKER_TAG) ./caddy
7 .PHONY: bp-caddy
8
9 bp-auth: bp-setup
10@@ -38,7 +38,7 @@ bp-auth: bp-setup
11 .PHONY: bp-auth
12
13 bp-bouncer: bp-setup
14- $(DOCKER_BUILDX_BUILD) -t ghcr.io/picosh/pico/bouncer:$(DOCKER_TAG) -f bouncer/Dockerfile ./bouncer
15+ $(DOCKER_BUILDX_BUILD) -t ghcr.io/picosh/pico/bouncer:$(DOCKER_TAG) ./bouncer
16 .PHONY: bp-bouncer
17
18 bp-%: bp-setup