@@ -13,10 +13,13 @@ jobs:
1313 include :
1414 - os : windows-latest
1515 executable : PicoCalc-SD-Formatter.exe
16+ asset_name : PicoCalc-SD-Formatter-Windows.exe
1617 - os : macos-latest
1718 executable : PicoCalc-SD-Formatter.app
19+ asset_name : PicoCalc-SD-Formatter-macOS.zip
1820 - os : ubuntu-latest
1921 executable : PicoCalc-SD-Formatter
22+ asset_name : PicoCalc-SD-Formatter-Linux
2023 runs-on : ${{ matrix.os }}
2124 permissions :
2225 contents : write
6265 run : |
6366 python build.py
6467
68+ - name : Package macOS App
69+ if : matrix.os == 'macos-latest'
70+ run : |
71+ cd dist
72+ zip -r PicoCalc-SD-Formatter-macOS.zip PicoCalc-SD-Formatter.app
73+ cd ..
74+
6575 - name : Debug build output
6676 shell : bash
6777 run : |
@@ -73,54 +83,16 @@ jobs:
7383 else
7484 echo "build directory does not exist"
7585 fi
76- echo "Contents of release directory (if exists):"
77- if [ -d "release" ]; then
78- ls -la release/
79- else
80- echo "release directory does not exist"
81- fi
8286 echo "Contents of current directory:"
8387 ls -la
8488
85- - name : Verify build output
86- shell : bash
87- run : |
88- if [ "${{ matrix.os }}" = "windows-latest" ]; then
89- if [ -f "dist/${{ matrix.executable }}" ]; then
90- echo "Windows executable found at dist/${{ matrix.executable }}"
91- else
92- echo "Windows executable not found at dist/${{ matrix.executable }}"
93- echo "Searching for executable in dist directory:"
94- find dist -type f -name "*.exe" || echo "No .exe files found"
95- exit 1
96- fi
97- elif [ "${{ matrix.os }}" = "macos-latest" ]; then
98- if [ -d "dist/${{ matrix.executable }}" ]; then
99- echo "macOS app bundle found at dist/${{ matrix.executable }}"
100- else
101- echo "macOS app bundle not found at dist/${{ matrix.executable }}"
102- echo "Searching for app bundle in dist directory:"
103- find dist -type d -name "*.app" || echo "No .app bundles found"
104- exit 1
105- fi
106- else
107- if [ -f "dist/${{ matrix.executable }}" ]; then
108- echo "Linux executable found at dist/${{ matrix.executable }}"
109- else
110- echo "Linux executable not found at dist/${{ matrix.executable }}"
111- echo "Searching for executable in dist directory:"
112- find dist -type f -executable || echo "No executable files found"
113- exit 1
114- fi
115- fi
116-
117- - name : Upload executable files
89+ - name : Upload artifact
11890 uses : actions/upload-artifact@v4
11991 with :
120- name : executables- ${{ matrix.os }}
121- path : dist/
122- if-no-files-found : warn
123- retention-days : 5
92+ name : ${{ matrix.asset_name }}
93+ path : |
94+ ${{ matrix.os == 'macos-latest' && 'dist/PicoCalc-SD-Formatter-macOS.zip' || format('dist/{0}', matrix.executable) }}
95+ if-no-files-found : error
12496
12597 release :
12698 needs : build
@@ -138,81 +110,44 @@ jobs:
138110 - name : Download all artifacts
139111 uses : actions/download-artifact@v4
140112 with :
141- path : dist
142- merge-multiple : true
113+ path : artifacts
114+ merge-multiple : false
143115
144116 - name : Display structure of downloaded files
145117 shell : bash
146118 run : |
147- echo "Contents of dist directory:"
148- ls -la dist/
149- echo "All files in dist directory (recursive):"
150- find dist -type f | sort
151- echo "All directories in dist directory:"
152- find dist -type d | sort
119+ echo "Contents of artifacts directory:"
120+ ls -la artifacts/
121+ echo "All files in artifacts directory (recursive):"
122+ find artifacts -type f | sort
153123
154124 - name : Get release notes
155125 id : get_release_notes
156126 run : |
157- # Get the tag name
158127 TAG_NAME=${GITHUB_REF#refs/tags/}
159-
160- # Get the previous tag
161128 PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
162129
163- # Generate release notes
164130 if [ -n "$PREVIOUS_TAG" ]; then
165131 RELEASE_NOTES=$(git log --pretty=format:"* %s" $PREVIOUS_TAG..$TAG_NAME)
166132 else
167133 RELEASE_NOTES=$(git log --pretty=format:"* %s" $TAG_NAME)
168134 fi
169135
170- {
171- echo "notes<<EOF"
172- echo "## Changes in $TAG_NAME"
173- echo ""
174- echo "$RELEASE_NOTES"
175- echo "EOF"
176- } >> $GITHUB_OUTPUT
136+ echo "notes=$(echo "$RELEASE_NOTES" | jq -Rsa .)" >> "$GITHUB_OUTPUT"
177137
178138 - name : Create Release
179139 id : create_release
180- uses : actions/create-release@v1
181- env :
182- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
183- with :
184- tag_name : ${{ github.ref_name }}
185- release_name : Release ${{ github.ref_name }}
186- body : ${{ steps.get_release_notes.outputs.notes }}
187- draft : false
188- prerelease : false
189-
190- - name : Upload Release Assets
191- uses : actions/upload-release-asset@v1
192140 env :
193141 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
194- with :
195- upload_url : ${{ steps.create_release.outputs.upload_url }}
196- asset_path : ./dist/PicoCalc-SD-Formatter.exe
197- asset_name : PicoCalc-SD-Formatter-Windows.exe
198- asset_content_type : application/octet-stream
199-
200- - name : Upload macOS Release Asset
201- uses : actions/upload-release-asset@v1
202- env :
203- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
204- with :
205- upload_url : ${{ steps.create_release.outputs.upload_url }}
206- asset_path : ./dist/PicoCalc-SD-Formatter.app
207- asset_name : PicoCalc-SD-Formatter-macOS.app
208- asset_content_type : application/octet-stream
209-
210- - name : Upload Linux Release Asset
211- uses : actions/upload-release-asset@v1
212- env :
213- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
214- with :
215- upload_url : ${{ steps.create_release.outputs.upload_url }}
216- asset_path : ./dist/PicoCalc-SD-Formatter
217- asset_name : PicoCalc-SD-Formatter-Linux
218- asset_content_type : application/octet-stream
142+ run : |
143+ gh release create "${{ github.ref_name }}" \
144+ --title "Release ${{ github.ref_name }}" \
145+ --notes "${{ fromJson(steps.get_release_notes.outputs.notes) }}" \
146+ --draft=false \
147+ --prerelease=false \
148+ artifacts/**/*
149+
150+ - name : Verify Release
151+ run : |
152+ echo "Release created successfully"
153+ echo "Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
0 commit comments