1717 default : ' patch'
1818 type : choice
1919 options :
20- - patch
21- - minor
22- - major
20+ - patch
21+ - minor
22+ - major
2323
2424jobs :
2525 build-tauri :
@@ -37,52 +37,42 @@ jobs:
3737 uses : actions/setup-node@v4
3838 with :
3939 node-version : 22
40-
41- - name : Cache Node.js Dependencies
42- uses : actions/cache@v4
43- with :
44- path : ~/.npm
45- key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
46- restore-keys : ${{ runner.os }}-node-
40+ # Use setup-node's built-in caching for simplicity and correctness
41+ cache : ' npm'
4742
4843 - name : Install Dependencies
4944 run : npm install
50- shell : bash
5145
5246 - name : Run Cross-Platform Build Script
5347 run : node build-desktop.js
54- shell : bash
5548
5649 - name : Setup Rust (stable)
5750 uses : dtolnay/rust-toolchain@stable
5851
5952 - name : Install Linux Dependencies (Ubuntu)
6053 if : matrix.os == 'ubuntu-latest'
6154 run : |
62- sudo apt update
63- sudo apt install libwebkit2gtk-4.1-dev \
64- build-essential \
65- curl \
66- wget \
67- file \
68- libxdo-dev \
69- libssl-dev \
70- libayatana-appindicator3-dev \
71- librsvg2-dev
72- shell : bash
55+ sudo apt-get update
56+ sudo apt-get install -y libwebkit2gtk-4.1-dev \
57+ build-essential \
58+ curl \
59+ wget \
60+ file \
61+ libxdo-dev \
62+ libssl-dev \
63+ libayatana-appindicator3-dev \
64+ librsvg2-dev
7365
7466 - name : Install macOS Dependencies
7567 if : matrix.os == 'macos-latest'
76- run : |
77- brew update
78- brew install pkg-config
79- shell : bash
68+ run : brew install pkg-config
8069
8170 - name : Install Windows Dependencies
8271 if : matrix.os == 'windows-latest'
8372 shell : powershell
8473 run : |
85- choco install -y wixtoolset nsis microsoft-edge-webview2-runtime
74+ # Use 'upgrade' to be idempotent and the correct package name
75+ choco upgrade --no-progress -y wixtoolset nsis microsoft-edge-webview2-runtime.evergreen.standalone
8676
8777 - name : Cache Rust Dependencies
8878 uses : Swatinem/rust-cache@v2
@@ -91,14 +81,12 @@ jobs:
9181
9282 - name : Build Tauri App
9383 run : npm run tauri build
94- shell : bash
9584
9685 - name : Upload Tauri Build Artifacts
9786 uses : actions/upload-artifact@v4
9887 with :
99- name : Tauri Build Artifacts (${{ matrix.os }})
100- path : |
101- src-tauri/target/release/bundle
88+ name : Tauri-Build-Artifacts-${{ matrix.os }}
89+ path : src-tauri/target/release/bundle/
10290
10391 create-release :
10492 runs-on : ubuntu-latest
@@ -111,62 +99,56 @@ jobs:
11199
112100 - name : Generate Changelog
113101 id : changelog
114- uses : TriPSs/conventional-changelog-action@v3
102+ uses : TriPSs/conventional-changelog-action@v5
115103 with :
116104 github-token : ${{ secrets.GITHUB_TOKEN }}
117105
118106 - name : Download all build artifacts
119107 uses : actions/download-artifact@v4
120108 with :
121109 path : artifacts
110+ # Merge artifacts from different OS into a single directory
111+ merge-multiple : true
122112
123113 - name : Prepare Release Assets
124114 run : |
125115 mkdir -p release-assets
126- # Move all built files (.deb, .AppImage, .msi, .dmg) into one folder
127- # The '|| true' prevents the workflow from failing if a specific file type doesn't exist
128- find artifacts -type f \( -name "*.deb" -o -name "*.AppImage" -o -name "*.msi" -o -name "*.dmg" \) -exec cp {} release-assets/ \; || true
129116
130- if [ -d "artifacts/Tauri Build Artifacts (macos-latest)/src-tauri/target/release/bundle/macos" ]; then
131- cd "artifacts/Tauri Build Artifacts (macos-latest)/src-tauri/target/release/bundle/macos"
132- for app in *.app; do
133- zip -r "../../../release-assets/${app%.app}.zip" "$app"
134- done
135- cd -
117+ # Move primary assets
118+ find artifacts -maxdepth 2 -type f \( -name "*.deb" -o -name "*.AppImage" -o -name "*.msi" -o -name "*.dmg" \) -exec mv {} release-assets/ \;
119+
120+ # Find and zip the macOS .app bundle
121+ APP_BUNDLE=$(find artifacts -name "*.app" -type d -maxdepth 2 | head -n 1)
122+ if [[ -d "$APP_BUNDLE" ]]; then
123+ APP_NAME=$(basename "$APP_BUNDLE" .app)
124+ pushd "$(dirname "$APP_BUNDLE")"
125+ zip -r "../../release-assets/${APP_NAME}.zip" "$(basename "$APP_BUNDLE")"
126+ popd
136127 fi
137128
138129 echo "Prepared release assets:"
139130 ls -l release-assets/
140131
141- - name : Install GitHub CLI
142- run : |
143- type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
144- curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
145- && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
146- && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
147- && sudo apt update \
148- && sudo apt install gh -y
149-
150132 - name : Determine New Version and Create GitHub Release
151133 env :
152134 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
153135 run : |
154136 # Fetch the latest tag from the repository
155137 LATEST_TAG=$(git tag --sort=-v:refname | head -n 1)
156138 if [[ -z "$LATEST_TAG" ]]; then
157- # If no tags exist, start from v0.0.0
158- LATEST_TAG="v0.0.0"
139+ LATEST_TAG="v0.0.0" # Start from v0.0.0 if no tags exist
159140 fi
160141
161142 # Parse the latest tag to get major, minor, and patch numbers
162- if [[ "$LATEST_TAG" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
143+ if [[ "$LATEST_TAG" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
163144 MAJOR=${BASH_REMATCH[1]}
164145 MINOR=${BASH_REMATCH[2]}
165146 PATCH=${BASH_REMATCH[3]}
166147 else
167148 echo "Could not parse latest tag: $LATEST_TAG. Starting from v0.1.0."
168149 MAJOR=0; MINOR=1; PATCH=0
169150 fi
151+
170152 # Increment the version based on the manual input
171153 BUMP_TYPE="${{ github.event.inputs.version-bump }}"
172154 if [ "$BUMP_TYPE" == "major" ]; then
@@ -177,20 +159,13 @@ jobs:
177159 PATCH=$((PATCH + 1))
178160 fi
179161
180- if [ -n "${{ steps.changelog.outputs.tag }}" ]; then
181- NEW_VERSION="${{ steps.changelog.outputs.tag }}"
182- echo "Using tag from changelog output: $NEW_VERSION"
183- else
184- NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
185- fi
162+ NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
186163 echo "Creating new release: $NEW_VERSION"
187164
188- # Get the release notes generated by the changelog action
189165 CHANGELOG_NOTES_FILE="RELEASE_NOTES.md"
190166 printf "%s\n" "${{ steps.changelog.outputs.changelog }}" > "$CHANGELOG_NOTES_FILE"
191167
192- # Create the GitHub Release and upload all assets
193- test -n "$(ls -A release-assets 2>/dev/null)" || { echo "No assets to upload"; exit 1; }
168+ # Use GitHub CLI to create the release
194169 gh release create "$NEW_VERSION" \
195170 --title "CircuitVerse Desktop $NEW_VERSION" \
196171 --notes-file "$CHANGELOG_NOTES_FILE" \
0 commit comments