name: Publish Docker Image on: push: branches: - main env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: 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 ./libraries 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 clang-format-examples: 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 ./plugins/storage_test_plugin/src --exclude ./plugins/storage_test_plugin/src/catch2 build-examples: runs-on: ubuntu-22.04 needs: clang-format-examples steps: - 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 ../storage_test_plugin docker run --rm -v ${PWD}:/project builder make build-and-push-image: runs-on: ubuntu-latest needs: [build-lib, build-examples] permissions: contents: read packages: write steps: - 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: | type=raw,value={{date 'YYYYMMDD'}}-{{sha}} type=raw,value={{date 'YYYYMMDD'}} type=raw,value=latest - 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