Skip to content

Commit

Permalink
Add github.ref_name == master in registry-actions.yml (#32)
Browse files Browse the repository at this point in the history
* Add github.ref_name == master in `registry-actions.yml`

* Correct username for github packages
  • Loading branch information
rudra-iitm authored Dec 16, 2024
1 parent aac3090 commit ab6ef3d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/registry-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -73,25 +73,27 @@ jobs:
uses: docker/[email protected]
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
Expand All @@ -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

0 comments on commit ab6ef3d

Please sign in to comment.