|
6 | 6 | pull_request: |
7 | 7 | branches: [main] |
8 | 8 |
|
| 9 | +permissions: |
| 10 | + contents: write # Required for creating draft releases |
| 11 | + |
9 | 12 | env: |
10 | 13 | VERSION: '' # Will be set from package.json |
11 | 14 |
|
@@ -131,3 +134,50 @@ jobs: |
131 | 134 | name: GhostDraw-${{ env.VERSION }}-portable |
132 | 135 | path: GhostDraw-${{ env.VERSION }}-portable.zip |
133 | 136 | retention-days: 30 |
| 137 | + |
| 138 | + # Only create/update draft release if the tag doesn't exist yet |
| 139 | + # This allows CI to run safely whether tag exists or not |
| 140 | + - name: Check if tag exists |
| 141 | + id: check_tag |
| 142 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 143 | + shell: pwsh |
| 144 | + run: | |
| 145 | + $tagName = "v${{ env.VERSION }}" |
| 146 | + git fetch --tags |
| 147 | + $tagExists = git tag -l $tagName |
| 148 | + if ($tagExists) { |
| 149 | + Write-Host "Tag $tagName already exists - skipping draft release" |
| 150 | + echo "tag_exists=true" >> $env:GITHUB_OUTPUT |
| 151 | + } else { |
| 152 | + Write-Host "Tag $tagName does not exist - will create/update draft release" |
| 153 | + echo "tag_exists=false" >> $env:GITHUB_OUTPUT |
| 154 | + } |
| 155 | +
|
| 156 | + - name: Create or update draft release |
| 157 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.check_tag.outputs.tag_exists == 'false' |
| 158 | + uses: softprops/action-gh-release@v2 |
| 159 | + with: |
| 160 | + tag_name: v${{ env.VERSION }} |
| 161 | + name: GhostDraw v${{ env.VERSION }} |
| 162 | + draft: true |
| 163 | + prerelease: false |
| 164 | + generate_release_notes: true |
| 165 | + files: | |
| 166 | + Installer/bin/x64/Release/GhostDrawSetup-${{ env.VERSION }}.msi |
| 167 | + GhostDraw-${{ env.VERSION }}-portable.zip |
| 168 | + body: | |
| 169 | + ## GhostDraw v${{ env.VERSION }} |
| 170 | +
|
| 171 | + ### Downloads |
| 172 | + - **GhostDrawSetup-${{ env.VERSION }}.msi** - Windows installer |
| 173 | + - **GhostDraw-${{ env.VERSION }}-portable.zip** - Portable version (no installation required) |
| 174 | +
|
| 175 | + ### Installation |
| 176 | + 1. Download the MSI installer or portable ZIP |
| 177 | + 2. Run the installer or extract the ZIP to a folder of your choice |
| 178 | + 3. Launch GhostDraw from the Start Menu or the extracted folder |
| 179 | +
|
| 180 | + --- |
| 181 | + *Edit this draft to add release notes, then publish when ready.* |
| 182 | + env: |
| 183 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments