A local-first personal finance app
prevent duplicate draft releases (#8381)
Matt Fiddaman88e1e5fc174c
diff --git a/.github/workflows/electron-master.yml b/.github/workflows/electron-master.ymlindex b9702c0068..b1bc1f5114 100644--- a/.github/workflows/electron-master.yml+++ b/.github/workflows/electron-master.yml@@ -17,7 +17,39 @@ concurrency:cancel-in-progress: falsejobs:+ create-release:+ permissions:+ contents: write+ runs-on: ubuntu-latest+ steps:+ - name: Process release version+ id: process_version+ run: |+ echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"+ - name: Create draft release+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ GH_REPO: ${{ github.repository }}+ TAG: ${{ github.ref_name }}+ RELEASE_NOTES: |+ :link: [View release notes](https://actualbudget.org/blog/release-${{ steps.process_version.outputs.version }})++ ## Desktop releases+ Please note: Microsoft store updates can sometimes lag behind the main release by a couple of days while they verify the new version.++ <p>+ <a href="https://apps.microsoft.com/detail/9p2hmlhsdbrm?cid=Github+Releases&mode=direct"><img src="https://get.microsoft.com/images/en-us%20dark.svg" width="200" /></a>+ <img src="data:image/gif;base64,R0lGODlhAQABAAAAACw=" width="12" height="1" alt="" />+ <a href="https://flathub.org/apps/com.actualbudget.actual"><img width="165" style="margin-left:12px;" alt="Get it on Flathub" src="https://flathub.org/api/badge?locale=en" /></a>+ </p>+ run: |+ # don't create duplicates+ if ! gh release view "$TAG" >/dev/null 2>&1; then+ gh release create "$TAG" --draft --title "$TAG" --notes "$RELEASE_NOTES"+ fi+build:+ needs: create-release# this is so the assets can be added to the releasepermissions:contents: write@@ -102,32 +134,12 @@ jobs:name: actual-electron-${{ matrix.os }}-appxpath: |packages/desktop-electron/dist/*.appx- - name: Add to new release+ - name: Add to releaseenv:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}GH_REPO: ${{ github.repository }}TAG: ${{ github.ref_name }}- RELEASE_NOTES: |- :link: [View release notes](https://actualbudget.org/blog/release-${{ steps.process_version.outputs.version }})-- ## Desktop releases- Please note: Microsoft store updates can sometimes lag behind the main release by a couple of days while they verify the new version.-- <p>- <a href="https://apps.microsoft.com/detail/9p2hmlhsdbrm?cid=Github+Releases&mode=direct"><img src="https://get.microsoft.com/images/en-us%20dark.svg" width="200" /></a>- <img src="data:image/gif;base64,R0lGODlhAQABAAAAACw=" width="12" height="1" alt="" />- <a href="https://flathub.org/apps/com.actualbudget.actual"><img width="165" style="margin-left:12px;" alt="Get it on Flathub" src="https://flathub.org/api/badge?locale=en" /></a>- </p>run: |- # The matrix runs three OS jobs in parallel against one release;- # only ignore the "already exists" error that the race losers hit.- if ! create_output=$(gh release create "$TAG" --draft --title "$TAG" --notes "$RELEASE_NOTES" 2>&1); then- if [[ "$create_output" != *already_exists* ]]; then- echo "$create_output" >&2- exit 1- fi- fi-shopt -s extglob nullglobfiles=(packages/desktop-electron/dist/*.dmgdiff --git a/upcoming-release-notes/fix-duplicate-draft-releases.md b/upcoming-release-notes/fix-duplicate-draft-releases.mdnew file mode 100644index 0000000000..ddf56d44e1--- /dev/null+++ b/upcoming-release-notes/fix-duplicate-draft-releases.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [matt-fidd]+---++Prevent duplicate draft releases being created by the Electron release job