Skip to content

Commit

Permalink
Update build CI to use PyDis specific config
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed May 13, 2024
1 parent 71fd383 commit eeeaba3
Showing 1 changed file with 11 additions and 53 deletions.
64 changes: 11 additions & 53 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,80 +4,38 @@ on:
workflow_call:

jobs:
build-base:
name: Build & push base image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate docker image metadata
uses: docker/metadata-action@v4
id: meta
with:
images: ghcr.io/supakeen/pinnwand
tags: |
type=ref,event=tag,enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Containerfile
target: base
push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
cache-from: type=registry,ref=ghcr.io/supakeen/pinnwand:latest
cache-to: type=inline
tags: ${{ steps.meta.outputs.tags }}

build-additional-images:
build-image:
name: Build & push additional images
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container-stage: ["psql","mysql"]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Github Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate docker image metadata
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/supakeen/pinnwand
images: ghcr.io/python-discord/pinnwand
tags: |
type=ref,event=tag,suffix=-${{ matrix.container-stage }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=raw,value=latest-${{ matrix.container-stage }}
type=ref,event=tag,suffix=psql
type=raw,value=latest-psql
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: ./Containerfile
target: ${{ matrix.container-stage }}
push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
cache-from: type=registry,ref=ghcr.io/supakeen/pinnwand:latest-${{ matrix.container-stage }}
target: psql
cache-from: type=registry,ref=ghcr.io/python-discord/pinnwand:latest-psql
cache-to: type=inline
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit eeeaba3

Please sign in to comment.