diff --git a/.github/workflows/on-main-push.yaml b/.github/workflows/on-main-push.yaml index e16a9d8..141c23e 100644 --- a/.github/workflows/on-main-push.yaml +++ b/.github/workflows/on-main-push.yaml @@ -5,6 +5,11 @@ on: push: branches: - main + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: tag-scan-and-push-final-image: name: "Build, scan, and publish tagged image" @@ -27,9 +32,15 @@ jobs: - name: Login to ghcr.io uses: docker/login-action@v2 with: - registry: ghcr.io - username: weave-ghcr-bot - password: ${{ secrets.KURED_WEAVE_GHCR_BOT_TOKEN }} + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -50,4 +61,5 @@ jobs: platforms: linux/arm64, linux/amd64, linux/arm/v7, linux/arm/v6, linux/386 push: true tags: | - ghcr.io/${{ GITHUB.REPOSITORY }}:main-${{ steps.tags.outputs.sha_short }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-${{ steps.tags.outputs.sha_short }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/on-tag.yaml b/.github/workflows/on-tag.yaml index ed9265f..8bfd851 100644 --- a/.github/workflows/on-tag.yaml +++ b/.github/workflows/on-tag.yaml @@ -7,6 +7,11 @@ on: push: tags: - "*" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: tag-scan-and-push-final-image: name: "Build, scan, and publish tagged image" @@ -38,9 +43,15 @@ jobs: - name: Login to ghcr.io uses: docker/login-action@v2 with: - registry: ghcr.io - username: weave-ghcr-bot - password: ${{ secrets.KURED_WEAVE_GHCR_BOT_TOKEN }} + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -59,4 +70,6 @@ jobs: # cache-from: type=registry,ref=user/app:buildcache # cache-to: type=inline tags: | - ghcr.io/${{ GITHUB.REPOSITORY }}:${{ steps.tags.outputs.version }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.version }} + labels: ${{ steps.meta.outputs.labels }} +