From 8dc84a3b3d8855517571013b44abb06fdc6a6033 Mon Sep 17 00:00:00 2001 From: Jan Schutte <4732389+SchutteJan@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:06:05 +0200 Subject: [PATCH] chore: format build-image workflow --- .github/workflows/build-image.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 5426916..08b0fe2 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -2,9 +2,9 @@ name: Image build on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] env: IMAGE_NAME: kroegen @@ -12,21 +12,20 @@ env: REPO_OWNER: schuttejan jobs: - build: runs-on: ubuntu-latest permissions: packages: write contents: read steps: - # https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions - - uses: actions/checkout@v4 - - name: Build the image - run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" - - name: Log in to registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - name: Push image - run: | + # https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions + - uses: actions/checkout@v4 + - name: Build the image + run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + - name: Log in to registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Push image + run: | IMAGE_ID=ghcr.io/$REPO_OWNER/$IMAGE_NAME VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')