2021-01-16 23:00:50 +01:00
|
|
|
name: Publish Docker Image
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2024-03-29 08:59:40 +01:00
|
|
|
- '*-dev'
|
|
|
|
|
2023-03-16 11:38:00 +01:00
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
2021-01-16 23:00:50 +01:00
|
|
|
jobs:
|
2024-03-29 08:59:40 +01:00
|
|
|
clang-format-lib:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: clang-format
|
|
|
|
run: |
|
|
|
|
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./include ./source
|
|
|
|
build-lib:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
needs: clang-format-lib
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: build binary
|
|
|
|
run: |
|
|
|
|
docker build . -f Dockerfile.buildlocal -t builder
|
|
|
|
docker run --rm -v ${PWD}:/project builder make
|
2023-03-16 11:38:00 +01:00
|
|
|
build-and-push-image:
|
2021-01-16 23:00:50 +01:00
|
|
|
runs-on: ubuntu-latest
|
2024-03-29 08:59:40 +01:00
|
|
|
needs: [build-lib]
|
2023-03-16 11:38:00 +01:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
2021-01-16 23:00:50 +01:00
|
|
|
steps:
|
2023-03-16 11:38:00 +01:00
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Extract Docker metadata
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
tags: |
|
2024-03-29 08:59:40 +01:00
|
|
|
type=raw,value={{branch}}-{{date 'YYYYMMDD'}}-{{sha}},enable=${{ github.ref != format('refs/heads/{0}', 'main') }}
|
|
|
|
type=raw,value={{date 'YYYYMMDD'}}-{{sha}},enable={{is_default_branch}}
|
|
|
|
type=raw,value={{date 'YYYYMMDD'}},enable={{is_default_branch}}
|
|
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
2023-03-16 11:38:00 +01:00
|
|
|
|
|
|
|
- name: Log into registry ${{ env.REGISTRY }}
|
|
|
|
uses: docker/login-action@v2.1.0
|
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.CI_PAT_WRITE_PACKAGE }}
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
push: true
|