Skip to content

Commit

Permalink
Break out reused code
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniomika committed Nov 9, 2023
1 parent 0abe68c commit 04ed23f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 27 deletions.
36 changes: 36 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Setup main action

description: Runs the setup required for docker building

inputs:
registry:
description: The docker registry to use
required: true
default: ghcr.io
username:
description: The docker registry to use
required: true
password:
description: The docker registry to use
required: true

runs:
using: composite
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}
52 changes: 25 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,8 @@ jobs:
matrix:
APP: [lists, prose, pastes, imgs, pgs, feeds]
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Login to Docker Hub
uses: docker/login-action@v2
- name: Setup docker
uses: ./.github/actions/setup
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -69,23 +58,12 @@ jobs:
app: ${{ matrix.APP }}
platforms: ${{ env.PLATFORMS }}
registry: ${{ env.REGISTRY }}
build-misc:
build-auth:
runs-on: ubuntu-22.04
needs: test
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Login to Docker Hub
uses: docker/login-action@v2
- name: Setup docker
uses: ./.github/actions/setup
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -97,6 +75,16 @@ jobs:
platforms: ${{ env.PLATFORMS }}
registry: ${{ env.REGISTRY }}
ssh: false
build-bouncer:
runs-on: ubuntu-22.04
needs: test
steps:
- name: Setup docker
uses: ./.github/actions/setup
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Collect bouncer image metadata
id: bouncermeta
uses: docker/metadata-action@v4
Expand All @@ -112,6 +100,16 @@ jobs:
platforms: ${{ env.PLATFORMS }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-caddy:
runs-on: ubuntu-22.04
needs: test
steps:
- name: Setup docker
uses: ./.github/actions/setup
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Collect caddy image metadata
id: caddymeta
uses: docker/metadata-action@v4
Expand Down

0 comments on commit 04ed23f

Please sign in to comment.