repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
09c53d9
parent
1ce0105
author
Antonio Mika
date
2022-12-12 00:48:20 +0000 UTC
Merge pull request #6 from picosh/am/no-matrix

Change build to use composite instead of matrix action
2 files changed,  +78, -20
A .github/actions/build/action.yml
+54, -0
 1@@ -0,0 +1,54 @@
 2+name: Run a docker build
 3+
 4+description: Runs a docker build in a composite action
 5+
 6+inputs:
 7+  app:
 8+    description: The pico app to build
 9+    required: true
10+  platforms:
11+    description: The docker platforms to build for
12+    required: false
13+    default: |
14+      linux/amd64
15+      linux/arm64
16+  registry:
17+    description: The docker registry to use
18+    required: false
19+    default: ghcr.io
20+
21+runs:
22+  using: composite
23+  steps:
24+    - name: Collect web image metadata
25+      id: webmeta
26+      uses: docker/metadata-action@v4
27+      with:
28+        images: ${{ inputs.REGISTRY }}/${{ github.repository }}/${{ inputs.app }}-web
29+    - name: Collect ssh image metadata
30+      id: sshmeta
31+      uses: docker/metadata-action@v4
32+      with:
33+        images: ${{ inputs.REGISTRY }}/${{ github.repository }}/${{ inputs.app }}-ssh
34+    - name: Build and push web
35+      uses: docker/build-push-action@v3
36+      with:
37+        context: .
38+        push: true
39+        tags: ${{ steps.webmeta.outputs.tags }}
40+        labels: ${{ steps.webmeta.outputs.labels }}
41+        target: release-web
42+        platforms: ${{ inputs.platforms }}
43+        build-args: |
44+          APP=${{ inputs.app }}
45+    - name: Build and push ssh
46+      uses: docker/build-push-action@v3
47+      with:
48+        context: .
49+        push: true
50+        tags: ${{ steps.sshmeta.outputs.tags }}
51+        labels: ${{ steps.sshmeta.outputs.labels }}
52+        target: release-ssh
53+        platforms: ${{ inputs.platforms }}
54+        build-args: |
55+          APP=${{ inputs.app }}
M .github/workflows/build.yml
+24, -20
 1@@ -13,7 +13,7 @@ on:
 2 
 3 env:
 4   REGISTRY: ghcr.io
 5-  PLATFORM: |
 6+  PLATFORMS: |
 7     linux/amd64
 8     linux/arm64
 9 
10@@ -40,10 +40,6 @@ jobs:
11         go test -v ./... -cover -race -coverprofile=coverage.out
12         go tool cover -func=coverage.out -o=coverage.out
13   build:
14-    strategy:
15-      matrix:
16-        app: [prose, lists, pastes, imgs]
17-        target: [ssh, web]
18     runs-on: ubuntu-22.04
19     needs: test
20     steps:
21@@ -64,22 +60,30 @@ jobs:
22         registry: ${{ env.REGISTRY }}
23         username: ${{ github.actor }}
24         password: ${{ secrets.GITHUB_TOKEN }}
25-    - name: Collect image metadata
26-      id: meta
27-      uses: docker/metadata-action@v4
28+    - name: Run docker build for lists
29+      uses: ./.github/actions/build
30       with:
31-        images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.app }}-${{ matrix.target }}
32-    - name: Build and push
33-      uses: docker/build-push-action@v3
34+        app: lists
35+        platforms: ${{ env.PLATFORMS }}
36+        registry: ${{ env.REGISTRY }}
37+    - name: Run docker build for prose
38+      uses: ./.github/actions/build
39       with:
40-        context: .
41-        push: true
42-        tags: ${{ steps.meta.outputs.tags }}
43-        labels: ${{ steps.meta.outputs.labels }}
44-        target: release-${{ matrix.target }}
45-        platform: ${{ env.PLATFORM }}
46-        build-args: |
47-          APP=${{ matrix.app }}
48+        app: prose
49+        platforms: ${{ env.PLATFORMS }}
50+        registry: ${{ env.REGISTRY }}
51+    - name: Run docker build for pastes
52+      uses: ./.github/actions/build
53+      with:
54+        app: pastes
55+        platforms: ${{ env.PLATFORMS }}
56+        registry: ${{ env.REGISTRY }}
57+    - name: Run docker build for imgs
58+      uses: ./.github/actions/build
59+      with:
60+        app: imgs
61+        platforms: ${{ env.PLATFORMS }}
62+        registry: ${{ env.REGISTRY }}
63   build-caddy:
64     runs-on: ubuntu-22.04
65     needs: test
66@@ -113,4 +117,4 @@ jobs:
67         push: true
68         tags: ${{ steps.meta.outputs.tags }}
69         labels: ${{ steps.meta.outputs.labels }}
70-        platform: ${{ env.PLATFORM }}
71+        platforms: ${{ env.PLATFORMS }}