From dd618e4e4d5fa6624a778f7d0f2b061bd34056ba Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 8 Sep 2024 17:36:10 +0000 Subject: [PATCH] Fix release pipeline --- .github/workflows/build-push-release.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-push-release.yml b/.github/workflows/build-push-release.yml index cf85a49..b6663f2 100644 --- a/.github/workflows/build-push-release.yml +++ b/.github/workflows/build-push-release.yml @@ -82,16 +82,27 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This is needed for the gh cli - # Create a preview tag if on the main branch + # Create a preview tag if on the main branch and dist has changed - name: Create Preview Tag - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' && steps.check_dist_changes.outputs.dist_changed == 'true' run: | git tag v${{ steps.gitversion.outputs.semVer }} git push origin v${{ steps.gitversion.outputs.semVer }} - # Create Release if on a release branch + # Create a draft release for the preview tag if on the main branch and dist has changed + - name: Create Draft Release + if: github.ref == 'refs/heads/main' && steps.check_dist_changes.outputs.dist_changed == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create v${{ steps.gitversion.outputs.semVer }} \ + --title "Preview Release ${{ steps.gitversion.outputs.semVer }}" \ + --notes "This is a preview release for version ${{ steps.gitversion.outputs.semVer }}." \ + --draft + + # Create Release if on a release branch and dist has changed - name: Create Release - if: startsWith(github.ref, 'refs/heads/releases/') + if: startsWith(github.ref, 'refs/heads/releases/') && steps.check_dist_changes.outputs.dist_changed == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: |