From dfc8b3f8bf41f6f773687706d691e2fde66dbbf6 Mon Sep 17 00:00:00 2001 From: Hoang Dinh Date: Mon, 25 Mar 2024 16:09:31 +1000 Subject: [PATCH] chore: build for ubuntu --- .github/actions/build-ubuntu/action.yaml | 21 +++++++++ .github/workflows/release.yaml | 26 ++++------- scripts/snap/create-snapcraft-yaml.sh | 55 ++++++++++++++++++++++++ snapcraft.yaml | 29 ------------- 4 files changed, 85 insertions(+), 46 deletions(-) create mode 100644 .github/actions/build-ubuntu/action.yaml create mode 100644 scripts/snap/create-snapcraft-yaml.sh delete mode 100644 snapcraft.yaml diff --git a/.github/actions/build-ubuntu/action.yaml b/.github/actions/build-ubuntu/action.yaml new file mode 100644 index 000000000..a5191aba8 --- /dev/null +++ b/.github/actions/build-ubuntu/action.yaml @@ -0,0 +1,21 @@ +name: 'Build for Ubuntu' +runs: + using: 'composite' + steps: + - name: install dependencies (ubuntu only) + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + shell: bash + + - name: build tauri app + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload binary as artifact + uses: actions/upload-artifact@v3 + with: + name: algokit-explorer-linux-${{ runner.arch }} + path: | + src-tauri/target/release/algokit-explorer diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index bfc5bb58b..2cdb586ff 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -71,14 +71,14 @@ jobs: release-version: ${{ steps.create-release-action.outputs.release-version }} release-id: ${{ steps.create-release-action.outputs.release-id }} - package-tauri: + build-tauri: + name: Build Tauri app needs: - create-release runs-on: ${{ matrix.platform }} strategy: matrix: - platform: [macos-latest] - name: Package Tauri app + platform: [ubuntu-20.04] if: ${{ needs.create-release.outputs.release-published == 'true' }} steps: @@ -94,21 +94,13 @@ jobs: - name: install Rust stable uses: dtolnay/rust-toolchain@stable - - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-20.04' - run: | - sudo apt-get update - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + - name: install npm dependencies + run: npm install - - name: bump version in package.json + - name: bump version in tauri.conf.json run: | sed -i '' "s/\"version\": \"0.0.0\"/\"version\": \"${{ needs.create-release.outputs.release-version }}\"/g" "src-tauri/tauri.conf.json" - - name: install app dependencies - run: npm install - - - uses: tauri-apps/tauri-action@v0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - releaseId: ${{ needs.create-release.outputs.release-id }} + - name: build for ubuntu + if: ${{ runner.os == 'Linux' }} + uses: ./.github/actions/build-ubuntu diff --git a/scripts/snap/create-snapcraft-yaml.sh b/scripts/snap/create-snapcraft-yaml.sh new file mode 100644 index 000000000..ea16efc1c --- /dev/null +++ b/scripts/snap/create-snapcraft-yaml.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# Ensure the script fails on errors +set -e + +# Check if the correct number of arguments are passed +if [ "$#" -ne 4 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Assign arguments to variables +DESTINATION_DIR="$1" +RELEASE_TAG="$2" +GRADE="$3" + +# Ensure the destination directory exists +mkdir -p "${DESTINATION_DIR}/snap" + +# Extract version from RELEASE_TAG, assuming it's in the format "vX.Y.Z" +VERSION="${RELEASE_TAG#v}" + +# Create the snapcraft.yaml file +cat > "${DESTINATION_DIR}/snap/snapcraft.yaml" <