Skip to content

Commit d798c1d

Browse files
authored
Update build.yml
1 parent ad691c1 commit d798c1d

1 file changed

Lines changed: 34 additions & 42 deletions

File tree

.github/workflows/build.yml

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,13 @@ jobs:
3838
env:
3939
GH_TOKEN: ${{ secrets.GH_PAT }}
4040

41-
- name: Rename Linux installers
42-
run: |
43-
VERSION=${{ needs.read-version.outputs.version }}
44-
for f in dist/*.AppImage dist/*.deb; do
45-
ext="${f##*.}"
46-
mv "$f" "dist/linux-AutoCaption-v${VERSION}.${ext}"
47-
done
48-
4941
- name: Upload Linux installers
5042
uses: actions/upload-artifact@v4
5143
with:
5244
name: linux-build
53-
path: dist/linux-AutoCaption-v*.{deb,AppImage}
45+
path: |
46+
dist/*.deb
47+
dist/*.AppImage
5448
5549
build-windows:
5650
needs: read-version
@@ -75,23 +69,11 @@ jobs:
7569
env:
7670
GH_TOKEN: ${{ secrets.GH_PAT }}
7771

78-
- name: Rename Windows installer
79-
shell: bash
80-
run: |
81-
VERSION=${{ needs.read-version.outputs.version }}
82-
ARCH=${{ matrix.arch }}
83-
FILE=$(ls dist/*.exe | head -n 1)
84-
NAME="windows-AutoCaption-v${VERSION}"
85-
if [ "$ARCH" = "arm64" ]; then
86-
NAME="${NAME}-arm64"
87-
fi
88-
mv "$FILE" "dist/${NAME}.exe"
89-
9072
- name: Upload Windows installer
9173
uses: actions/upload-artifact@v4
9274
with:
93-
name: windows-build-${{ matrix.arch }}
94-
path: dist/windows-AutoCaption-v*.exe
75+
name: windows-build
76+
path: dist/*.exe
9577

9678
build-macos:
9779
needs: read-version
@@ -113,28 +95,16 @@ jobs:
11395
env:
11496
GH_TOKEN: ${{ secrets.GH_PAT }}
11597

116-
- name: Rename x64 .dmg
117-
run: |
118-
VERSION=${{ needs.read-version.outputs.version }}
119-
FILE=$(ls dist/*.dmg | grep -v arm64 | head -n 1)
120-
mv "$FILE" "dist/macos-AutoCaption-v${VERSION}-x64.dmg"
121-
12298
- name: Build macOS arm64
12399
run: npx electron-builder --mac --arm64
124100
env:
125101
GH_TOKEN: ${{ secrets.GH_PAT }}
126102

127-
- name: Rename arm64 .dmg
128-
run: |
129-
VERSION=${{ needs.read-version.outputs.version }}
130-
FILE=$(ls dist/*.dmg | head -n 1)
131-
mv "$FILE" "dist/macos-AutoCaption-v${VERSION}-arm64.dmg"
132-
133103
- name: Upload macOS installers
134104
uses: actions/upload-artifact@v4
135105
with:
136106
name: macos-build
137-
path: dist/macos-AutoCaption-v*.dmg
107+
path: dist/*.dmg
138108

139109
release:
140110
needs: [build-linux, build-windows, build-macos, read-version]
@@ -148,15 +118,37 @@ jobs:
148118
- name: List artifact directory contents
149119
run: find combined-artifacts
150120

121+
- name: Rename files for release
122+
run: |
123+
VERSION="v${{ needs.read-version.outputs.version }}"
124+
mkdir renamed
125+
126+
# Linux
127+
for f in combined-artifacts/linux-build/*; do
128+
ext="${f##*.}"
129+
cp "$f" "renamed/linux-AutoCaption-${VERSION}.${ext}"
130+
done
131+
132+
# Windows
133+
for f in combined-artifacts/windows-build/*; do
134+
base="$(basename "$f")"
135+
arch="x64"
136+
[[ "$base" == *arm64* ]] && arch="arm64"
137+
cp "$f" "renamed/windows-AutoCaption-${VERSION}-${arch}.exe"
138+
done
139+
140+
# macOS
141+
for f in combined-artifacts/macos-build/*; do
142+
base="$(basename "$f")"
143+
arch="x64"
144+
[[ "$base" == *arm64* ]] && arch="arm64"
145+
cp "$f" "renamed/macos-AutoCaption-${VERSION}-${arch}.dmg"
146+
done
147+
151148
- name: Create GitHub Release
152149
uses: softprops/action-gh-release@v2
153150
with:
154151
tag_name: v${{ needs.read-version.outputs.version }}
155152
name: v${{ needs.read-version.outputs.version }}
156-
files: |
157-
combined-artifacts/linux-build/linux-AutoCaption-v*.deb
158-
combined-artifacts/linux-build/linux-AutoCaption-v*.AppImage
159-
combined-artifacts/windows-build-x64/windows-AutoCaption-v*.exe
160-
combined-artifacts/windows-build-arm64/windows-AutoCaption-v*.exe
161-
combined-artifacts/macos-build/macos-AutoCaption-v*.dmg
153+
files: renamed/*
162154
token: ${{ secrets.GH_PAT }}

0 commit comments

Comments
 (0)