diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml index 329c477..3847792 100644 --- a/.github/workflows/ghcr.yml +++ b/.github/workflows/ghcr.yml @@ -7,8 +7,6 @@ on: push: tags: - v* - pull_request: [] - workflow_dispatch: jobs: push-image: @@ -20,15 +18,14 @@ jobs: - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Set IMAGE_ID + run: echo "IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME" | tr '[A-Z]' '[a-z]' >> $GITHUB_ENV - name: Build image - run: docker buildx build . --platform linux/amd64,linux/arm64 --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" --push + run: docker buildx build . --platform linux/amd64,linux/arm64 --tag $IMAGE_ID --label "runnumber=${GITHUB_RUN_ID}" --push - 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/${{ github.repository_owner }}/$IMAGE_NAME - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') [ "$VERSION" == "master" ] && VERSION=latest