File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,11 +21,20 @@ jobs:
2121
2222 - name : Extract repository name
2323 id : extract_repo_name
24- run : echo "REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2) " >> $GITHUB_ENV
24+ run : echo "BRANCH_NAME=${{ github.ref_name }} " >> $GITHUB_ENV
2525
2626 - name : Build and push Docker image
2727 uses : docker/build-push-action@v2
2828 with :
2929 context : .
3030 push : true
3131 tags : ${{ secrets.DOCKER_USERNAME }}/${{ env.REPO_NAME }}:latest
32+
33+ - name : Create or update GitHub Release
34+ env :
35+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36+ run : |
37+ RELEASE_NAME="Build for branch ${{ env.BRANCH_NAME }}"
38+ RELEASE_BODY="Docker image has been built and pushed successfully.\n\nTag: ${{ secrets.DOCKER_USERNAME }}/${{ env.BRANCH_NAME }}:latest"
39+ gh release create "${{ env.BRANCH_NAME }}" --notes "$RELEASE_BODY" || \
40+ gh release edit "${{ env.BRANCH_NAME }}" --notes "$RELEASE_BODY"
You can’t perform that action at this time.
0 commit comments