Skip to content

Commit

Permalink
chore: build for ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickDinh committed Mar 25, 2024
1 parent 4e0c8b6 commit dfc8b3f
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 46 deletions.
21 changes: 21 additions & 0 deletions .github/actions/build-ubuntu/action.yaml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 9 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
55 changes: 55 additions & 0 deletions scripts/snap/create-snapcraft-yaml.sh
Original file line number Diff line number Diff line change
@@ -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 <destination_directory> <release_tag> <artifact_path> <grade>"
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" <<EOF
name: algokit-explorer
base: core22
version: "$VERSION"
summary: Short description of algokit-explorer.
description: |
Detailed description of algokit-explorer.
confinement: classic
grade: $GRADE
parts:
algokit-explorer:
source: snap-dist
plugin: dump
build-packages:
- build-essential
stage-packages:
- libgtk-3-0
- libwebkit2gtk-4.0-37
apps:
algokit-explorer:
command: algokit-explorer
plugs:
- desktop-legacy
- home
- x11
- wayland
EOF

echo "snapcraft.yaml has been created at ${DESTINATION_DIR}/snap/snapcraft.yaml"
29 changes: 0 additions & 29 deletions snapcraft.yaml

This file was deleted.

0 comments on commit dfc8b3f

Please sign in to comment.