Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Docker Build Reusable

on:
workflow_call:
inputs:
push:
required: false
type: boolean
default: false
nginx_version:
required: true
type: string
tags:
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true

- name: Log in to Docker Hub
uses: docker/login-action@v4
if: inputs.push
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Log in to the Container registry
uses: docker/login-action@v4
if: inputs.push
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Labels
id: meta
uses: docker/metadata-action@v6
with:
images: |
cupcakearmy/static
ghcr.io/${{ github.repository }}
tags: ${{ inputs.tags }}

- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ inputs.push }}
platforms: linux/amd64,linux/arm64
build-args: NGINX=${{ inputs.nginx_version }}
tags: ${{ steps.meta.outputs.tags }}
58 changes: 7 additions & 51 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,15 @@ on:

jobs:
tags:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.fetcher.outputs.matrix }}
defaults:
run:
working-directory: tags
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun i
- id: fetcher
run: bun .
uses: ./.github/workflows/tags.yml

build:
runs-on: ubuntu-latest
needs: tags
strategy:
matrix: ${{fromJson(needs.tags.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true

- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Labels
id: meta
uses: docker/metadata-action@v6
with:
images: |
cupcakearmy/static
ghcr.io/${{ github.repository }}
tags: ${{ matrix.tags }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm64
build-args: NGINX=${{ matrix.version }}
tags: ${{ steps.meta.outputs.tags }}
uses: ./.github/workflows/build.yml
with:
push: true
nginx_version: ${{ matrix.version }}
tags: ${{ matrix.tags }}
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR Build

on:
pull_request:

jobs:
tags:
uses: ./.github/workflows/tags.yml

build:
needs: tags
strategy:
matrix: ${{fromJson(needs.tags.outputs.matrix)}}
uses: ./.github/workflows/build.yml
with:
push: false
nginx_version: ${{ matrix.version }}
tags: ${{ matrix.tags }}
23 changes: 23 additions & 0 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Fetch Nginx Tags

on:
workflow_call:
outputs:
matrix:
description: JSON matrix of nginx versions and docker tags
value: ${{ jobs.fetch.outputs.matrix }}

jobs:
fetch:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.fetcher.outputs.matrix }}
defaults:
run:
working-directory: tags
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun i
- id: fetcher
run: bun .
Loading