chore: improve artifact handling in build workflow with enhanced renaming and listing for Windows and Linux

This commit is contained in:
PandaDEV 2024-12-22 00:01:34 +10:00
parent 741cc51a01
commit ec00adcbb5
No known key found for this signature in database
GPG key ID: 13EFF9BAF70EE75C
2 changed files with 77 additions and 55 deletions

View file

@ -151,23 +151,46 @@ jobs:
- uses: tauri-apps/tauri-action@v0 - uses: tauri-apps/tauri-action@v0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Rename and Publish Windows Artifacts - name: List Bundle Directory
shell: pwsh
run: | run: |
mv src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi src-tauri/target/${{ matrix.target }}/release/bundle/msi/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.msi $bundlePath = "src-tauri/target/${{ matrix.target }}/release/bundle/msi"
mv src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi.sig src-tauri/target/${{ matrix.target }}/release/bundle/msi/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.msi.sig if (Test-Path $bundlePath) {
Write-Output "Contents of ${bundlePath}:"
Get-ChildItem -Path $bundlePath
} else {
Write-Output "Path ${bundlePath} does not exist."
}
- name: Rename Windows Artifacts
shell: pwsh
run: |
$bundlePath = "src-tauri/target/${{ matrix.target }}/release/bundle/msi"
$version = "${{ needs.prepare.outputs.version }}"
$arch = "${{ matrix.arch }}"
if (Test-Path $bundlePath) {
$msiFiles = Get-ChildItem -Path "$bundlePath/*.msi"
foreach ($file in $msiFiles) {
$newName = "Qopy-$version`_$arch.msi"
Rename-Item -Path $file.FullName -NewName $newName
}
} else {
Write-Error "Path ${bundlePath} does not exist."
exit 1
}
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: build-windows-msi-${{ matrix.arch }} name: windows-${{ matrix.arch }}-binaries
path: src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi path: src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi
- uses: actions/upload-artifact@v4
with:
name: updater-files-windows-${{ matrix.arch }}
path: |
src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi
src-tauri/target/${{ matrix.target }}/release/bundle/msi/*.msi.sig
build-ubuntu: build-ubuntu:
needs: prepare needs: prepare
strategy:
matrix:
include:
- target: "x86_64-unknown-linux-gnu"
arch: "x64"
- target: "aarch64-unknown-linux-gnu"
arch: "arm64"
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
@ -177,6 +200,8 @@ jobs:
with: with:
node-version: 20 node-version: 20
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: swatinem/rust-cache@v2 - uses: swatinem/rust-cache@v2
with: with:
workspaces: "src-tauri -> target" workspaces: "src-tauri -> target"
@ -192,33 +217,25 @@ jobs:
- name: install dependencies - name: install dependencies
run: | run: |
sudo apt update sudo apt update
sudo apt install libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libayatana-appindicator3-dev librsvg2-dev libasound2-dev sudo apt install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libayatana-appindicator3-dev librsvg2-dev libasound2-dev rpm
echo "PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig" >> $GITHUB_ENV echo "PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig" >> $GITHUB_ENV
- run: npm install -g pnpm && pnpm install - run: npm install -g pnpm && pnpm install
- uses: tauri-apps/tauri-action@v0 - uses: tauri-apps/tauri-action@v0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Rename and Publish Ubuntu Artifacts with:
args: --target ${{ matrix.target }}
- name: Rename Linux Artifacts
run: | run: |
mv src-tauri/target/release/bundle/deb/*.deb src-tauri/target/release/bundle/deb/Qopy-${{ needs.prepare.outputs.version }}.deb mv src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb src-tauri/target/${{ matrix.target }}/release/bundle/deb/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.deb
mv src-tauri/target/release/bundle/appimage/*.AppImage src-tauri/target/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}.AppImage mv src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage src-tauri/target/${{ matrix.target }}/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.AppImage
mv src-tauri/target/release/bundle/appimage/*.AppImage.sig src-tauri/target/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}.AppImage.sig mv src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage.sig src-tauri/target/${{ matrix.target }}/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.AppImage.sig
mv src-tauri/target/release/bundle/rpm/*.rpm src-tauri/target/release/bundle/rpm/Qopy-${{ needs.prepare.outputs.version }}.rpm mv src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm src-tauri/target/${{ matrix.target }}/release/bundle/rpm/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.rpm
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: build-ubuntu-deb name: linux-${{ matrix.arch }}-binaries
path: src-tauri/target/release/bundle/deb/*.deb
- uses: actions/upload-artifact@v4
with:
name: build-ubuntu-appimage
path: src-tauri/target/release/bundle/appimage/*.AppImage
- uses: actions/upload-artifact@v4
with:
name: build-ubuntu-rpm
path: src-tauri/target/release/bundle/rpm/*.rpm
- uses: actions/upload-artifact@v4
with:
name: updater-files-ubuntu
path: | path: |
src-tauri/target/release/bundle/appimage/*.AppImage src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
src-tauri/target/release/bundle/appimage/*.AppImage.sig src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage
src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage.sig
src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm

View file

@ -170,6 +170,13 @@ jobs:
build-linux: build-linux:
permissions: write-all permissions: write-all
needs: prepare needs: prepare
strategy:
matrix:
include:
- target: "x86_64-unknown-linux-gnu"
arch: "x64"
- target: "aarch64-unknown-linux-gnu"
arch: "arm64"
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
@ -181,6 +188,8 @@ jobs:
with: with:
node-version: 20 node-version: 20
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: swatinem/rust-cache@v2 - uses: swatinem/rust-cache@v2
with: with:
workspaces: "src-tauri -> target" workspaces: "src-tauri -> target"
@ -210,20 +219,20 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
args: --target x86_64-unknown-linux-gnu args: --target ${{ matrix.target }}
- name: Rename Linux Artifacts - name: Rename Linux Artifacts
run: | run: |
mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/Qopy-${{ needs.prepare.outputs.version }}.deb mv src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb src-tauri/target/${{ matrix.target }}/release/bundle/deb/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.deb
mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}.AppImage mv src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage src-tauri/target/${{ matrix.target }}/release/bundle/appimage/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.AppImage
mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/Qopy-${{ needs.prepare.outputs.version }}.rpm mv src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm src-tauri/target/${{ matrix.target }}/release/bundle/rpm/Qopy-${{ needs.prepare.outputs.version }}_${{ matrix.arch }}.rpm
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: linux-binaries name: linux-${{ matrix.arch }}-binaries
path: | path: |
src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage
src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
create-release: create-release:
permissions: write-all permissions: write-all
@ -250,19 +259,12 @@ jobs:
WINDOWS_64_HASH=$(sha256sum "artifacts/windows-x64-binaries/Qopy-${VERSION}_x64.msi" | awk '{ print $1 }') WINDOWS_64_HASH=$(sha256sum "artifacts/windows-x64-binaries/Qopy-${VERSION}_x64.msi" | awk '{ print $1 }')
MAC_SILICON_HASH=$(sha256sum "artifacts/macos-silicon-binaries/aarch64-apple-darwin/release/bundle/dmg/Qopy-${VERSION}_silicon.dmg" | awk '{ print $1 }') MAC_SILICON_HASH=$(sha256sum "artifacts/macos-silicon-binaries/aarch64-apple-darwin/release/bundle/dmg/Qopy-${VERSION}_silicon.dmg" | awk '{ print $1 }')
MAC_INTEL_HASH=$(sha256sum "artifacts/macos-intel-binaries/x86_64-apple-darwin/release/bundle/dmg/Qopy-${VERSION}_intel.dmg" | awk '{ print $1 }') MAC_INTEL_HASH=$(sha256sum "artifacts/macos-intel-binaries/x86_64-apple-darwin/release/bundle/dmg/Qopy-${VERSION}_intel.dmg" | awk '{ print $1 }')
DEBIAN_HASH=$(sha256sum "artifacts/linux-binaries/deb/Qopy-${VERSION}.deb" | awk '{ print $1 }') DEBIAN_X64_HASH=$(sha256sum "artifacts/linux-x64-binaries/deb/Qopy-${VERSION}_x64.deb" | awk '{ print $1 }')
APPIMAGE_HASH=$(sha256sum "artifacts/linux-binaries/appimage/Qopy-${VERSION}.AppImage" | awk '{ print $1 }') APPIMAGE_X64_HASH=$(sha256sum "artifacts/linux-x64-binaries/appimage/Qopy-${VERSION}_x64.AppImage" | awk '{ print $1 }')
REDHAT_HASH=$(sha256sum "artifacts/linux-binaries/rpm/Qopy-${VERSION}.rpm" | awk '{ print $1 }') RPM_X64_HASH=$(sha256sum "artifacts/linux-x64-binaries/rpm/Qopy-${VERSION}_x64.rpm" | awk '{ print $1 }')
DEBIAN_ARM64_HASH=$(sha256sum "artifacts/linux-arm64-binaries/deb/Qopy-${VERSION}_arm64.deb" | awk '{ print $1 }')
# Debug output APPIMAGE_ARM64_HASH=$(sha256sum "artifacts/linux-arm64-binaries/appimage/Qopy-${VERSION}_arm64.AppImage" | awk '{ print $1 }')
echo "Calculated hashes:" RPM_ARM64_HASH=$(sha256sum "artifacts/linux-arm64-binaries/rpm/Qopy-${VERSION}_arm64.rpm" | awk '{ print $1 }')
echo "Windows ARM: $WINDOWS_ARM_HASH"
echo "Windows x64: $WINDOWS_64_HASH"
echo "Mac Silicon: $MAC_SILICON_HASH"
echo "Mac Intel: $MAC_INTEL_HASH"
echo "Debian: $DEBIAN_HASH"
echo "AppImage: $APPIMAGE_HASH"
echo "Red Hat: $REDHAT_HASH"
RELEASE_BODY=$(cat <<-EOF RELEASE_BODY=$(cat <<-EOF
## ♻️ Changelog ## ♻️ Changelog
@ -275,9 +277,12 @@ jobs:
- [Windows (ARM64)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_arm64.msi) - ${WINDOWS_ARM_HASH} - [Windows (ARM64)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_arm64.msi) - ${WINDOWS_ARM_HASH}
- [macOS (Silicon)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_silicon.dmg) - ${MAC_SILICON_HASH} - [macOS (Silicon)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_silicon.dmg) - ${MAC_SILICON_HASH}
- [macOS (Intel)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_intel.dmg) - ${MAC_INTEL_HASH} - [macOS (Intel)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_intel.dmg) - ${MAC_INTEL_HASH}
- [Debian](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}.deb) - ${DEBIAN_HASH} - [Debian (x64)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_x64.deb) - ${DEBIAN_X64_HASH}
- [AppImage](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}.AppImage) - ${APPIMAGE_HASH} - [AppImage (x64)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_x64.AppImage) - ${APPIMAGE_X64_HASH}
- [Red Hat](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}.rpm) - ${REDHAT_HASH} - [Red Hat (x64)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_x64.rpm) - ${RPM_X64_HASH}
- [Debian (ARM64)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_arm64.deb) - ${DEBIAN_ARM64_HASH}
- [AppImage (ARM64)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_arm64.AppImage) - ${APPIMAGE_ARM64_HASH}
- [Red Hat (ARM64)](https://github.com/${{ github.repository }}/releases/download/v${VERSION}/Qopy-${VERSION}_arm64.rpm) - ${RPM_ARM64_HASH}
EOF EOF
) )