Skip to content

Commit 3d6dee0

Browse files
committed
fix: update release workflow to use non-deprecated GitHub Actions
- Update actions/upload-artifact from v3 to v4 - Update actions/download-artifact from v3 to v4 - Update actions/cache from v3 to v4 - Replace deprecated create-release and upload-release-asset with gh CLI - Fix automatic release asset uploads for v1.0.0
1 parent 4f446a0 commit 3d6dee0

File tree

1 file changed

+25
-37
lines changed

1 file changed

+25
-37
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
echo "Building version: $VERSION"
4444
4545
- name: Cache Composer dependencies
46-
uses: actions/cache@v3
46+
uses: actions/cache@v4
4747
with:
4848
path: vendor
4949
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -121,7 +121,7 @@ jobs:
121121
php artisan native:build mac $NATIVEPHP_ARCH
122122
123123
- name: Upload artifacts
124-
uses: actions/upload-artifact@v3
124+
uses: actions/upload-artifact@v4
125125
with:
126126
name: Clueless-${{ steps.version.outputs.VERSION }}-${{ matrix.arch }}
127127
path: dist/*.dmg
@@ -144,31 +144,33 @@ jobs:
144144
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
145145
146146
- name: Download x64 artifact
147-
uses: actions/download-artifact@v3
147+
uses: actions/download-artifact@v4
148148
with:
149149
name: Clueless-${{ steps.version.outputs.VERSION }}-x64
150150
path: ./artifacts/x64
151151

152152
- name: Download arm64 artifact
153-
uses: actions/download-artifact@v3
153+
uses: actions/download-artifact@v4
154154
with:
155155
name: Clueless-${{ steps.version.outputs.VERSION }}-arm64
156156
path: ./artifacts/arm64
157157

158-
- name: Create Release
159-
id: create_release
160-
uses: actions/create-release@v1
158+
- name: Upload Release Assets
161159
env:
162160
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
163-
with:
164-
tag_name: v${{ steps.version.outputs.VERSION }}
165-
release_name: Clueless v${{ steps.version.outputs.VERSION }}
166-
body: |
167-
## 🎉 Clueless v${{ steps.version.outputs.VERSION }}
161+
run: |
162+
# Find the existing release for v${{ steps.version.outputs.VERSION }}
163+
RELEASE_ID=$(gh api repos/${{ github.repository }}/releases/tags/v${{ steps.version.outputs.VERSION }} --jq '.id' || echo "")
164+
165+
if [ -z "$RELEASE_ID" ]; then
166+
# Create a new release if it doesn't exist
167+
gh release create v${{ steps.version.outputs.VERSION }} \
168+
--title "Clueless v${{ steps.version.outputs.VERSION }}" \
169+
--notes "## 🎉 Clueless v${{ steps.version.outputs.VERSION }}
168170
169171
### Downloads
170-
- 🖥️ **macOS (Apple Silicon)**: `Clueless-${{ steps.version.outputs.VERSION }}-arm64.dmg`
171-
- 🖥️ **macOS (Intel)**: `Clueless-${{ steps.version.outputs.VERSION }}-x64.dmg`
172+
- 🖥️ **macOS (Apple Silicon)**: \`Clueless-${{ steps.version.outputs.VERSION }}-arm64.dmg\`
173+
- 🖥️ **macOS (Intel)**: \`Clueless-${{ steps.version.outputs.VERSION }}-x64.dmg\`
172174
173175
### Installation
174176
1. Download the appropriate DMG file for your Mac
@@ -177,26 +179,12 @@ jobs:
177179
4. Launch Clueless from Applications
178180
179181
### What's New
180-
See [commits](https://github.com/${{ github.repository }}/commits/v${{ steps.version.outputs.VERSION }}) for details.
181-
draft: true
182-
prerelease: false
183-
184-
- name: Upload x64 DMG
185-
uses: actions/upload-release-asset@v1
186-
env:
187-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
188-
with:
189-
upload_url: ${{ steps.create_release.outputs.upload_url }}
190-
asset_path: ./artifacts/x64/Clueless-${{ steps.version.outputs.VERSION }}-x64.dmg
191-
asset_name: Clueless-${{ steps.version.outputs.VERSION }}-x64.dmg
192-
asset_content_type: application/x-apple-diskimage
193-
194-
- name: Upload arm64 DMG
195-
uses: actions/upload-release-asset@v1
196-
env:
197-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198-
with:
199-
upload_url: ${{ steps.create_release.outputs.upload_url }}
200-
asset_path: ./artifacts/arm64/Clueless-${{ steps.version.outputs.VERSION }}-arm64.dmg
201-
asset_name: Clueless-${{ steps.version.outputs.VERSION }}-arm64.dmg
202-
asset_content_type: application/x-apple-diskimage
182+
See [commits](https://github.com/${{ github.repository }}/commits/v${{ steps.version.outputs.VERSION }}) for details." \
183+
--draft
184+
fi
185+
186+
# Upload the artifacts
187+
gh release upload v${{ steps.version.outputs.VERSION }} \
188+
./artifacts/x64/Clueless-${{ steps.version.outputs.VERSION }}-x64.dmg \
189+
./artifacts/arm64/Clueless-${{ steps.version.outputs.VERSION }}-arm64.dmg \
190+
--clobber

0 commit comments

Comments
 (0)