From e751454f89e3799d4d1d1c050494be5f1fbee8af Mon Sep 17 00:00:00 2001 From: Christopher Serr Date: Sun, 21 Jul 2024 18:16:33 +0200 Subject: [PATCH] Automatically release Tauri binaries This makes it so we automatically release the Tauri binaries when we merge a new change to the master branch. --- .github/workflows/build_zip.sh | 27 +++++++++++++++++++++++++++ .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100755 .github/workflows/build_zip.sh diff --git a/.github/workflows/build_zip.sh b/.github/workflows/build_zip.sh new file mode 100755 index 00000000..8eee3708 --- /dev/null +++ b/.github/workflows/build_zip.sh @@ -0,0 +1,27 @@ +set -ex + +main() { + local src=$(pwd) \ + stage= + + if [[ $OS_NAME =~ ^macos\-.*$ ]]; then + stage=$(mktemp -d -t tmp) + else + stage=$(mktemp -d) + fi + + ls -lhA src-tauri/target/release/ + cp "src-tauri/target/release/LiveSplit One.exe" "$stage/LiveSplit One.exe" 2>/dev/null || : + + cd $stage + if [ "$OS_NAME" = "windows-latest" ]; then + 7z a $src/LiveSplitOne-$TARGET.zip * + else + tar czf $src/LiveSplitOne-$TARGET.tar.gz * + fi + cd $src + + rm -rf $stage +} + +main diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f20cb5c..20460b34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,8 @@ on: jobs: build: runs-on: ${{ matrix.os }} + permissions: + contents: write strategy: fail-fast: false matrix: @@ -34,6 +36,7 @@ jobs: target: x86_64-pc-windows-msvc binaryen: x86_64-windows cargo_bin: C:/Users/runneradmin/.cargo/bin + release_bin: LiveSplit One.exe - label: Tauri on Linux platform: tauri @@ -42,6 +45,7 @@ jobs: target: x86_64-unknown-linux-musl binaryen: x86_64-linux cargo_bin: /home/runner/.cargo/bin + release_bin: LiveSplit One - label: Tauri on macOS ARM platform: tauri @@ -50,6 +54,7 @@ jobs: target: aarch64-apple-darwin binaryen: arm64-macos cargo_bin: /Users/runner/.cargo/bin + release_bin: LiveSplit One steps: - name: Checkout commit @@ -195,3 +200,20 @@ jobs: publish_branch: gh-pages publish_dir: ./${{ matrix.dist_path }} force_orphan: true + + - name: Prepare Release (Tauri) + if: matrix.platform == 'tauri' + shell: bash + run: .github/workflows/build_zip.sh + env: + OS_NAME: ${{ matrix.os }} + TARGET: ${{ matrix.binaryen }} + + - name: Release (Tauri) + if: matrix.platform == 'tauri' + uses: softprops/action-gh-release@v2 + with: + files: LiveSplitOne-*.* + name: Latest + tag_name: latest + body: The latest desktop version of LiveSplit One, which has support for global hotkeys.