From 9374e0334a4dc69bec6f817b1c0c74e10ad53b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20Martin?= Date: Mon, 24 Jun 2024 14:26:30 -0700 Subject: [PATCH] Add workflow to publish to GHCR --- .github/workflows/ghcr.yml | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/ghcr.yml diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml new file mode 100644 index 00000000..9b6b6c5d --- /dev/null +++ b/.github/workflows/ghcr.yml @@ -0,0 +1,47 @@ +name: GHCR + +on: push + +env: + REGISTRY: ghcr.io + +jobs: + build-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + strategy: + matrix: + image: [nginx, service] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + submodules: recursive + + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/central-${{ matrix.image }} + + - name: Build and push ${{ matrix.image }} Docker image + uses: docker/build-push-action@v5 + with: + file: ${{ matrix.image }}.dockerfile + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}