Skip to content

Commit

Permalink
Updated actions to use releases
Browse files Browse the repository at this point in the history
  • Loading branch information
albbus-stack committed May 29, 2024
1 parent 53ee0c7 commit 88097e4
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 34 deletions.
46 changes: 35 additions & 11 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:

jobs:
build:
permissions: write-all
runs-on: ubuntu-latest

steps:
Expand All @@ -39,8 +40,25 @@ jobs:
id: ndk
with:
ndk-version: r26d
add-to-path: true
link-to-sdk: true
local-cache: true

- name: Setup NDK Environment Variables
env:
NDK_HOME: ${{ steps.ndk.outputs.ndk-path }}
run: |
echo "NDK_HOME=$NDK_HOME" >> $GITHUB_ENV
echo "ANDROID_NDK_HOME=$NDK_HOME" >> $GITHUB_ENV
echo "TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64" >> $GITHUB_ENV
echo "AR=$TOOLCHAIN/bin/llvm-ar" >> $GITHUB_ENV
echo "LD=$TOOLCHAIN/bin/ld" >> $GITHUB_ENV
echo "RANLIB=$TOOLCHAIN/bin/llvm-ranlib" >> $GITHUB_ENV
echo "STRIP=$TOOLCHAIN/bin/llvm-strip" >> $GITHUB_ENV
echo "PATH=$TOOLCHAIN/bin:$NDK_HOME:$PATH" >> $GITHUB_ENV
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
Expand Down Expand Up @@ -69,17 +87,20 @@ jobs:
- name: Generate TailwindCSS
run: bun build:tailwind

- name: Copy Cargo.mobile.toml
run: mv Cargo.mobile.toml Cargo.toml

- name: Run cargo mobile init
run: cargo mobile init

- name: Append release config to .cargo/config.toml file
- name: Append release config to .cargo/config.toml
run: |
{
cat .cargo/config.toml;
printf "\n[profile.release]\nopt-level = \"z\"\ndebug = false\nlto = true\ncodegen-units = 1\npanic = \"abort\"\nstrip = true\nincremental = false\n";
} > .cargo/config.toml
} > .cargo/config.toml && cat .cargo/config.toml && ls -la $TOOLCHAIN/bin
- name: Create .env file
- name: Create .env
env:
API_URL: ${{ secrets.API_URL }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
Expand All @@ -89,9 +110,7 @@ jobs:
run: printf "API_URL=$API_URL\nSUPABASE_URL=$SUPABASE_URL\nSUPABASE_API_KEY=$SUPABASE_API_KEY\nSUPABASE_JWT_SECRET=$SUPABASE_JWT_SECRET\nDATABASE_URL=$DATABASE_URL\n" > .env

- name: Build
env:
NDK_HOME: ${{ steps.ndk.outputs.ndk-path }}
run: mv Cargo.toml Cargo.toml.bak && cp Cargo.mobile.toml Cargo.toml && cargo android apk build --release --split-per-abi
run: cargo android apk build --release --split-per-abi

- name: Sign APKs with keystore
env:
Expand All @@ -106,8 +125,13 @@ jobs:
jarsigner -keystore release.keystore ./gen/android/app/build/outputs/apk/x86/release/app-x86-release-unsigned.apk $ANDROID_KEYSTORE_ALIAS
jarsigner -keystore release.keystore ./gen/android/app/build/outputs/apk/x86_64/release/app-x86_64-release-unsigned.apk $ANDROID_KEYSTORE_ALIAS
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: apk
path: gen/android/app/build/outputs/apk/**/*.apk
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: apk
# path: gen/android/app/build/outputs/apk/**/*.apk

# or Upload to a release

- name: Upload to release v1.0.0
run: gh release upload v1.0.0 ./gen/android/app/build/outputs/apk/**/*.apk --clobber
3 changes: 0 additions & 3 deletions .github/workflows/deploy-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
- "Dockerfile"
- "api/**"
- "common/**"
# pull_request:
# branches:
# - master
workflow_dispatch:

jobs:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ on:
- "src/**"
- "common/**"
- "assets/**"
# pull_request:
# branches:
# - master
workflow_dispatch:

permissions:
Expand Down
27 changes: 18 additions & 9 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:

jobs:
build:
permissions: write-all
runs-on: ubuntu-latest

steps:
Expand All @@ -35,7 +36,7 @@ jobs:
uses: Swatinem/rust-cache@v2

- name: Install development dependencies
run: sudo apt-get install -y build-essential libgtk-3-dev libjavascriptcoregtk-4.1-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev libxdo-dev
run: sudo apt-get install -y libgtk-3-dev libjavascriptcoregtk-4.1-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev libxdo-dev

- name: Install Bun
uses: oven-sh/setup-bun@v1
Expand All @@ -51,10 +52,13 @@ jobs:
- name: Install Dioxus CLI
run: cargo install dioxus-cli

- name: Create .cargo/config.toml file
- name: Copy Cargo.desktop.toml
run: mv Cargo.desktop.toml Cargo.toml

- name: Create .cargo/config.toml
run: mkdir .cargo && printf "[profile.release]\nopt-level = \"z\"\ndebug = false\nlto = true\ncodegen-units = 1\npanic = \"abort\"\nstrip = true\nincremental = false\n" > .cargo/config.toml

- name: Create .env file
- name: Create .env
env:
API_URL: ${{ secrets.API_URL }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
Expand All @@ -64,10 +68,15 @@ jobs:
run: printf "API_URL=$API_URL\nSUPABASE_URL=$SUPABASE_URL\nSUPABASE_API_KEY=$SUPABASE_API_KEY\nSUPABASE_JWT_SECRET=$SUPABASE_JWT_SECRET\nDATABASE_URL=$DATABASE_URL\n" > .env

- name: Build
run: mv Cargo.toml Cargo.toml.bak && cp Cargo.desktop.toml Cargo.toml && WEBKIT_DISABLE_COMPOSITING_MODE=1 dx bundle --platform desktop --release --package deb
run: WEBKIT_DISABLE_COMPOSITING_MODE=1 dx bundle --platform desktop --release --package deb

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux
path: dist/bundle/deb/**/*
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: linux
# path: dist/bundle/deb/**/*

# or Upload to a release

- name: Upload to release v1.0.0
run: gh release upload v1.0.0 ./dist/bundle/deb/**/*.deb --clobber
25 changes: 17 additions & 8 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:

jobs:
build:
permissions: write-all
runs-on: windows-latest

steps:
Expand Down Expand Up @@ -48,11 +49,14 @@ jobs:
- name: Install Dioxus CLI
run: cargo install dioxus-cli

- name: Create .cargo/config.toml file
- name: Copy Cargo.desktop.toml
run: mv Cargo.desktop.toml Cargo.toml

- name: Create .cargo/config.toml
shell: bash
run: mkdir .cargo && printf "[profile.release]\nopt-level = \"z\"\ndebug = false\nlto = true\ncodegen-units = 1\npanic = \"abort\"\nstrip = true\nincremental = false\n" > .cargo/config.toml

- name: Create .env file
- name: Create .env
env:
API_URL: ${{ secrets.API_URL }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
Expand All @@ -63,10 +67,15 @@ jobs:
run: printf "API_URL=$API_URL\nSUPABASE_URL=$SUPABASE_URL\nSUPABASE_API_KEY=$SUPABASE_API_KEY\nSUPABASE_JWT_SECRET=$SUPABASE_JWT_SECRET\nDATABASE_URL=$DATABASE_URL\n" > .env

- name: Build
run: mv Cargo.toml Cargo.toml.bak && cp Cargo.desktop.toml Cargo.toml && dx bundle --platform desktop --release
run: dx bundle --platform desktop --release

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows
path: dist/bundle/msi/**/*.msi
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: windows
# path: dist/bundle/msi/**/*.msi

# or Upload to a release

- name: Upload to release v1.0.0
run: gh release upload v1.0.0 ./dist/bundle/msi/**/*.msi --clobber
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ rustc-link-lib = ["libpq"]
```

- Run migrations using `bun migrate` or call directly the `diesel` CLI inside the `api` folder.
- Database access is gated to authenticated users but you can change that easily in the `api/src/handlers.rs` file by removing the JWT verification.

### Supabase Storage

Expand Down

0 comments on commit 88097e4

Please sign in to comment.