From 03126859716b40d507d50858416f07befcf2a66d Mon Sep 17 00:00:00 2001 From: Srijan-SS02 Date: Thu, 23 May 2024 21:47:27 +0530 Subject: [PATCH 1/6] Added release.yml to Push sarthi image on release to GH packages Signed-off-by: Srijan-SS02 --- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..dbc053c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release Docker Image + +on: + release: + types: [published] + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: all + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository }}/my-image:latest + ghcr.io/${{ github.repository }}/my-image:${{ github.event.release.tag_name }} From 0bf862566af842cb722135cefcbcd0fd6ec0bcd3 Mon Sep 17 00:00:00 2001 From: Srijan-SS02 Date: Thu, 23 May 2024 21:53:28 +0530 Subject: [PATCH 2/6] updated release.yml Signed-off-by: Srijan-SS02 --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dbc053c..d3ced71 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,5 +33,5 @@ jobs: context: . push: true tags: | - ghcr.io/${{ github.repository }}/my-image:latest - ghcr.io/${{ github.repository }}/my-image:${{ github.event.release.tag_name }} + ghcr.io/srijan-ss02/sarthi/my-image:latest + ghcr.io/srijan-ss02/sarthi/my-image:${{ github.event.release.tag_name}} \ No newline at end of file From ed6a14fef590fae81850607c2b4acad630dd02f9 Mon Sep 17 00:00:00 2001 From: Srijan-SS02 Date: Thu, 23 May 2024 22:02:01 +0530 Subject: [PATCH 3/6] updated for lower case tags Signed-off-by: Srijan-SS02 --- .github/workflows/release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d3ced71..3e0199f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,10 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Get release tag name + id: vars + run: echo "RELEASE_TAG=$(echo ${{ github.event.release.tag_name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + - name: Build and push Docker image uses: docker/build-push-action@v5 with: @@ -34,4 +38,4 @@ jobs: push: true tags: | ghcr.io/srijan-ss02/sarthi/my-image:latest - ghcr.io/srijan-ss02/sarthi/my-image:${{ github.event.release.tag_name}} \ No newline at end of file + ghcr.io/srijan-ss02/sarthi/my-image:${{ env.RELEASE_TAG }} From 691aadd88bf1f6d51f0b21f85d42b124e98e6dfc Mon Sep 17 00:00:00 2001 From: Srijan-SS02 Date: Thu, 23 May 2024 22:10:49 +0530 Subject: [PATCH 4/6] updated release.yml for interpolation of repository variable Signed-off-by: Srijan-SS02 --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e0199f..569bab2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,5 +37,5 @@ jobs: context: . push: true tags: | - ghcr.io/srijan-ss02/sarthi/my-image:latest - ghcr.io/srijan-ss02/sarthi/my-image:${{ env.RELEASE_TAG }} + ghcr.io/${{ github.repository }}/sarthi:latest + ghcr.io/${{ github.repository }}/sarthi:${{ env.RELEASE_TAG }} From 91a0d3d9e4603b5dc94cfc7d128eebaff11a7011 Mon Sep 17 00:00:00 2001 From: Srijan-SS02 Date: Thu, 23 May 2024 22:18:17 +0530 Subject: [PATCH 5/6] Updated release.yml Signed-off-by: Srijan-SS02 --- .github/workflows/release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 569bab2..3f35190 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,6 +26,10 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + + - name: Convert repository name to lowercase + run: echo "REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + - name: Get release tag name id: vars @@ -37,5 +41,5 @@ jobs: context: . push: true tags: | - ghcr.io/${{ github.repository }}/sarthi:latest - ghcr.io/${{ github.repository }}/sarthi:${{ env.RELEASE_TAG }} + ghcr.io/${{ env.REPOSITORY }}/sarthi:latest + ghcr.io/${{ env.REPOSITORY }}/sarthi:${{ env.RELEASE_TAG }} From 0ec86799f30049a85cd49b8b91249fcdda5c5324 Mon Sep 17 00:00:00 2001 From: Srijan-SS02 Date: Wed, 29 May 2024 13:28:55 +0530 Subject: [PATCH 6/6] chore: format release.yml with prettier Signed-off-by: Srijan-SS02 --- .github/workflows/release.yml | 67 +++++++++++++++++------------------ 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3f35190..ff7c23e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,37 +9,36 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Convert repository name to lowercase - run: echo "REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - - - - name: Get release tag name - id: vars - run: echo "RELEASE_TAG=$(echo ${{ github.event.release.tag_name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: | - ghcr.io/${{ env.REPOSITORY }}/sarthi:latest - ghcr.io/${{ env.REPOSITORY }}/sarthi:${{ env.RELEASE_TAG }} + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: all + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Convert repository name to lowercase + run: echo "REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + + - name: Get release tag name + id: vars + run: echo "RELEASE_TAG=$(echo ${{ github.event.release.tag_name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ghcr.io/${{ env.REPOSITORY }}/sarthi:latest + ghcr.io/${{ env.REPOSITORY }}/sarthi:${{ env.RELEASE_TAG }}