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:
|
2022-02-03 16:24:36 +01:00
|
|
|
clang-format-lib:
|
2022-09-04 09:51:04 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-02-03 16:24:36 +01:00
|
|
|
steps:
|
2024-05-05 14:37:09 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-02-03 16:24:36 +01:00
|
|
|
- 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
|
2022-02-03 16:37:43 +01:00
|
|
|
build-lib:
|
2022-09-04 09:51:04 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-02-03 16:37:43 +01:00
|
|
|
needs: clang-format-lib
|
|
|
|
steps:
|
2024-05-05 14:37:09 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-02-03 16:37:43 +01:00
|
|
|
- name: build binary
|
|
|
|
run: |
|
|
|
|
docker build . -f Dockerfile.buildlocal -t builder
|
|
|
|
docker run --rm -v ${PWD}:/project builder make
|
2022-02-03 16:24:36 +01:00
|
|
|
clang-format-examples:
|
2022-09-04 09:51:04 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-02-03 16:24:36 +01:00
|
|
|
steps:
|
2024-05-05 14:37:09 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-02-03 16:24:36 +01:00
|
|
|
- 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
|
2023-12-16 17:16:43 +01:00
|
|
|
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
|
2022-02-03 16:24:36 +01:00
|
|
|
build-examples:
|
2022-09-04 09:51:04 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-02-03 16:24:36 +01:00
|
|
|
needs: clang-format-examples
|
|
|
|
steps:
|
2024-05-05 14:37:09 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-02-03 16:24:36 +01:00
|
|
|
- name: build binary
|
|
|
|
run: |
|
|
|
|
docker build . -f Dockerfile.buildexamples -t builder
|
|
|
|
cd ./plugins/example_plugin
|
2023-12-16 17:16:43 +01:00
|
|
|
docker run --rm -v ${PWD}:/project builder make
|
|
|
|
cd ../example_plugin_cpp
|
|
|
|
docker run --rm -v ${PWD}:/project builder make
|
|
|
|
cd ../storage_test_plugin
|
2022-02-03 16:24:36 +01:00
|
|
|
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
|
2023-03-16 12:51:41 +01:00
|
|
|
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
|
2024-05-05 14:37:09 +02:00
|
|
|
uses: actions/checkout@v4
|
2023-03-16 12:46:07 +01:00
|
|
|
- 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
|