From 553c7060456a534aef9546df394079d8f57c0f57 Mon Sep 17 00:00:00 2001 From: Martyn Ranyard Date: Tue, 7 Nov 2023 18:41:48 +0100 Subject: [PATCH] fix target and maybe cache, plus release flow --- .gitea/workflows/release.yaml | 35 +++++++++++++++++++++++++++++++++++ buildall.sh | 16 ++++++++++------ 2 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 .gitea/workflows/release.yaml diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..9d7ddf3 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,35 @@ +name: release + +on: + push: + tags: + - '*' + +jobs: + release: + runs-on: ubuntu-latest + container: + image: imartyn/rust-xwin:dev + steps: + - name: Install gotempl + run: | + mkdir -p $HOME/bin + wget -O $HOME/bin/gotempl https://github.com/link-society/gotempl/releases/download/v0.7.0/gotempl-linux-amd64 + chmod +x $HOME/bin/gotempl + - name: Check out repository code + uses: actions/checkout@v3 + - name: build + run: | + bash -c 'source "$HOME/.cargo/env" ;\ + bash buildall.sh' + - name: Release the binaries + id: use-go-action + uses: actions/release-action@main + with: + files: |- + app/src-tauri/target/release/bundle/deb/*.deb + app/src-tauri/target/release/bundle/appimage/*.AppImage + app/src-tauri/target/release/bundle/nsis/*.exe + app/src-tauri/target/release/bundle/msi/*.msi + app/src-tauri/target/release/*.exe + api_key: '${{secrets.RELEASE_TOKEN}}' \ No newline at end of file diff --git a/buildall.sh b/buildall.sh index decd12b..555ddf1 100644 --- a/buildall.sh +++ b/buildall.sh @@ -1,9 +1,9 @@ #!/bin/sh -FS_DIR_CACHE_ROOT="$HOME/.cache/fs-dir-cache" # directory to hold all cache (sub)directories -FS_DIR_CACHE_LOCK_ID="pid-$$-rnd-$RANDOM" # acquire lock based on the current pid and something random (just in case pid gets reused) -FS_DIR_CACHE_KEY_NAME="build-project-x" # the base name of our key -FS_DIR_CACHE_LOCK_TIMEOUT_SECS="3600" # unlock after timeout (1h) in case our job fails misereably +export FS_DIR_CACHE_ROOT="$HOME/.cache/fs-dir-cache" # directory to hold all cache (sub)directories +export FS_DIR_CACHE_LOCK_ID="pid-$$-rnd-$RANDOM" # acquire lock based on the current pid and something random (just in case pid gets reused) +export FS_DIR_CACHE_KEY_NAME="build-project-x" # the base name of our key +export FS_DIR_CACHE_LOCK_TIMEOUT_SECS="3600" # unlock after timeout (1h) in case our job fails misereably cargo install fs-dir-cache mkdir -p app @@ -19,12 +19,16 @@ for i in $(seq 0 $(expr $(jq '. | length' < apps.json) - 1)); do cp -r ../template/src-tauri . $HOME/bin/gotempl --data-json data.json< ../template/src-tauri/Cargo.toml > src-tauri/Cargo.toml $HOME/bin/gotempl --data-json data.json< ../template/src-tauri/tauri.conf.json > src-tauri/tauri.conf.json - cd src-tauri + cd src-tauri/icons + wget $(jq -r .icon < ../../data.json) -O icon.svg + inkscape icon.svg --export-filename=icon.png --export-width=1024 + convert -background none icon.png -gravity center -extent 1024x1024 icon-square.png + cd .. fs-dir-cache gc unused --seconds "$((7 * 24 * 60 * 60))" # delete caches not used in more than a week cache_dir=$(fs-dir-cache lock --key-file Cargo.toml) trap "fs-dir-cache unlock --dir ${cache_dir}" EXIT cargo tauri build - cargo tauri build --target i686-pc-windows-msvc + cargo tauri build --target x86_64-pc-windows-msvc cd .. cd .. done \ No newline at end of file