From 0a1b264d7ca82fccd154c55cb4c50db9fb2ab270 Mon Sep 17 00:00:00 2001 From: Vatsal Gupta <40350810+gvatsal60@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:57:17 +0000 Subject: [PATCH] Added Release Feature --- .github/workflows/docker-img-push.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/docker-img-push.yaml b/.github/workflows/docker-img-push.yaml index c223ddb..c25be60 100644 --- a/.github/workflows/docker-img-push.yaml +++ b/.github/workflows/docker-img-push.yaml @@ -3,6 +3,8 @@ on: push: branches: - master + tags: + - 'v*' pull_request: jobs: build: @@ -53,3 +55,24 @@ jobs: tags: ghcr.io/${{ github.actor }}/${{ env.IMG_REPO_NAME }}:${{ env.TAG_NAME }} cache-from: type=registry,ref=ghcr.io/${{ github.actor }}/${{ env.IMG_REPO_NAME }}:${{ env.TAG_NAME }} cache-to: type=registry,ref=ghcr.io/${{ github.actor }}/${{ env.IMG_REPO_NAME }}:${{ env.TAG_NAME }},mode=max + - name: Save Docker image to tarball + if: github.event_name == 'push' + run: | + docker save ghcr.io/${{ github.actor }}/${{ env.IMG_REPO_NAME }}:${{ env.TAG_NAME }} -o ${{ env.IMG_REPO_NAME }}.tar + - name: Create GitHub release + if: github.event_name == 'push' + uses: actions/create-release@v1 + with: + tag_name: ${{ env.TAG_NAME }} + release_name: Release ${{ env.TAG_NAME }} + draft: false + prerelease: false + id: create_release + - name: Upload tar as release asset + if: github.event_name == 'push' + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.IMG_REPO_NAME }}.tar + asset_name: ${{ env.IMG_REPO_NAME }}.tar + asset_content_type: application/x-tar