WiiUPluginSystem/.github/workflows/push_image.yml

86 lines
2.8 KiB
YAML
Raw Normal View History

2020-12-16 15:03:17 +01:00
name: Publish Docker Image
on:
push:
branches:
2023-04-07 19:58:08 +02:00
- main
2023-11-05 17:15:43 +01:00
- '*-dev'
2023-03-16 12:46:07 +01:00
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
2020-12-16 15:03:17 +01:00
jobs:
clang-format-lib:
runs-on: ubuntu-22.04
steps:
2023-03-16 12:46:36 +01:00
- uses: actions/checkout@v3
- name: clang-format
run: |
2023-03-16 12:46:07 +01:00
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./include ./libraries
build-lib:
runs-on: ubuntu-22.04
needs: clang-format-lib
steps:
2023-03-16 12:46:36 +01:00
- uses: actions/checkout@v3
- name: build binary
run: |
docker build . -f Dockerfile.buildlocal -t builder
docker run --rm -v ${PWD}:/project builder make
clang-format-examples:
runs-on: ubuntu-22.04
steps:
2023-03-16 12:46:36 +01:00
- uses: actions/checkout@v3
- name: clang-format
run: |
2023-10-14 09:42:08 +02:00
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./plugins/storage_test_plugin/src --exclude ./plugins/storage_test_plugin/src/catch2
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./plugins/example_plugin/src
docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./plugins/example_plugin_cpp/src
build-examples:
runs-on: ubuntu-22.04
needs: clang-format-examples
steps:
2023-03-16 12:46:36 +01:00
- uses: actions/checkout@v3
- name: build binary
run: |
docker build . -f Dockerfile.buildexamples -t builder
cd ./plugins/example_plugin
docker run --rm -v ${PWD}:/project builder make
cd ../example_plugin_cpp
docker run --rm -v ${PWD}:/project builder make
cd ../storage_test_plugin
docker run --rm -v ${PWD}:/project builder make
2023-03-16 12:46:07 +01:00
build-and-push-image:
2020-12-16 15:03:17 +01:00
runs-on: ubuntu-latest
needs: [build-lib, build-examples]
2023-03-16 12:46:07 +01:00
permissions:
contents: read
packages: write
2020-12-16 15:03:17 +01:00
steps:
2023-03-16 12:46:07 +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: |
2023-11-05 17:15:43 +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 12:46:07 +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