From d06550a381ea4b1a2a84877d9b9fd34191663ebb Mon Sep 17 00:00:00 2001 From: rudra-iitm Date: Sun, 15 Dec 2024 23:10:06 +0530 Subject: [PATCH 1/2] Add github.ref_name == master in `registry-actions.yml` --- .github/workflows/registry-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/registry-actions.yml b/.github/workflows/registry-actions.yml index 46052c1..6c909d5 100644 --- a/.github/workflows/registry-actions.yml +++ b/.github/workflows/registry-actions.yml @@ -40,7 +40,7 @@ jobs: publish-rock: needs: build-rock - if: github.ref_name == 'main' + if: github.ref_name == 'main' || github.ref_name == 'master' runs-on: ubuntu-latest steps: - name: Checkout repository From 5c132d6cbe245f4a8de9bff68fa3a3659f9a0433 Mon Sep 17 00:00:00 2001 From: rudra-iitm Date: Mon, 16 Dec 2024 08:08:42 +0530 Subject: [PATCH 2/2] Correct username for github packages --- .github/workflows/registry-actions.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/registry-actions.yml b/.github/workflows/registry-actions.yml index 6c909d5..09074bb 100644 --- a/.github/workflows/registry-actions.yml +++ b/.github/workflows/registry-actions.yml @@ -73,25 +73,27 @@ jobs: uses: docker/login-action@v3.2.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push Docker Image (Edge & Latest Channel) if: github.event.inputs.workflow_choice == 'edge' || github.event.inputs.workflow_choice == 'both' || github.event_name == 'push' || github.event_name == 'workflow_run' env: USERNAME: ${{ secrets.DOCKER_USERNAME }} + ORG_NAME: ${{ github.repository_owner }} run: | IMAGE="$(yq '.name' rockcraft.yaml)" VERSION="$(yq '.version' rockcraft.yaml)" ROCK="$(ls *.rock | tail -n 1)" - sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:"${USERNAME}/${IMAGE}:${VERSION}-edge" + sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:"${ORG_NAME}/${IMAGE}:${VERSION}-edge" # Push to Docker Hub + # docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-edge ${USERNAME}:${VERSION}-edge # docker push ${USERNAME}/${IMAGE}:${VERSION}-edge # docker tag ${USERNAME}/${IMAGE}:${VERSION}-edge ${USERNAME}/${IMAGE}:latest # docker push ${USERNAME}/${IMAGE}:latest # Push to GitHub Packages - GITHUB_IMAGE="ghcr.io/${{ github.repository_owner }}/${IMAGE}" - docker tag ${USERNAME}/${IMAGE}:${VERSION}-edge ${GITHUB_IMAGE}:${VERSION}-edge + GITHUB_IMAGE="ghcr.io/${ORG_NAME}/${IMAGE}" + docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-edge ${GITHUB_IMAGE}:${VERSION}-edge docker push ${GITHUB_IMAGE}:${VERSION}-edge docker tag ${GITHUB_IMAGE}:${VERSION}-edge ${GITHUB_IMAGE}:latest docker push ${GITHUB_IMAGE}:latest @@ -100,14 +102,15 @@ jobs: if: github.event.inputs.workflow_choice == 'stable' || github.event.inputs.workflow_choice == 'both' env: USERNAME: ${{ secrets.DOCKER_USERNAME }} + ORG_NAME: ${{ github.repository_owner }} run: | IMAGE="$(yq '.name' rockcraft.yaml)" VERSION="$(yq '.version' rockcraft.yaml)" ROCK="$(ls *.rock | tail -n 1)" - sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:"${USERNAME}/${IMAGE}:${VERSION}-stable" + sudo rockcraft.skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:"${ORG_NAME}/${IMAGE}:${VERSION}-stable" # Push to Docker Hub # docker push ${USERNAME}/${IMAGE}:${VERSION}-stable # Push to GitHub Packages - GITHUB_IMAGE="ghcr.io/${{ github.repository_owner }}/${IMAGE}" - docker tag ${USERNAME}/${IMAGE}:${VERSION}-stable ${GITHUB_IMAGE}:${VERSION}-stable + GITHUB_IMAGE="ghcr.io/${ORG_NAME}/${IMAGE}" + docker tag ${ORG_NAME}/${IMAGE}:${VERSION}-stable ${GITHUB_IMAGE}:${VERSION}-stable docker push ${GITHUB_IMAGE}:${VERSION}-stable