Skip to content

Commit

Permalink
chore: environment variable substitution for the Tauri build
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickDinh committed Dec 4, 2024
1 parent 0b1c863 commit 4115f7e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
10 changes: 9 additions & 1 deletion .github/actions/build-linux/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ runs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libxdo-dev \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev
shell: bash

- name: Bump version in tauri.conf.json
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ jobs:
release-tag: ${{ steps.create-release-action.outputs.release-tag }}
release-id: ${{ steps.create-release-action.outputs.release-id }}

# TODO: VITE_ tokens need to be replaced after building, but before bundling the Tauri app
build-tauri:
name: Build Tauri app
needs:
Expand All @@ -84,7 +83,7 @@ jobs:
strategy:
matrix:
# macos-14 is the Apple Silicon M1 runner
platform: [ubuntu-20.04, windows-latest, 'macos-12', 'macos-14']
platform: [ubuntu-22.04, windows-latest, 'macos-12', 'macos-14']
if: ${{ needs.create-release.outputs.release-published == 'true' }}

steps:
Expand All @@ -103,6 +102,22 @@ jobs:
- name: Install npm dependencies
run: npm install

- name: Create .env file
run: |
sed -E -n 's/(VITE_[A-Z0-9_]+)=(.*)/\1="{{\1}}"/p' .env.sample > .env
- name: Substitute environment variables
uses: bluwy/substitute-string-action@v3
with:
_input-file: '.env'
_format-key: '{{key}}'
_output-file: '.env'
VITE_DISPENSER_AUTH0_DOMAIN: dispenser-prod.eu.auth0.com
VITE_DISPENSER_AUTH0_CLIENT_ID: Cg13HjvSV45pMme4dnK9yVJde8tVeDaM
VITE_DISPENSER_AUTH0_AUDIENCE: api-prod-dispenser-user
VITE_TESTNET_DISPENSER_API_URL: https://api.dispenser.algorandfoundation.tools
VITE_TESTNET_DISPENSER_ADDRESS: Z5GPJQCHVU54C2I4FLYNE2XHRQRL5OV2GPJQKXJFMW34CRIN2KRQFXF7DI

- name: Build for Linux
id: build-linux
if: ${{ runner.os == 'Linux' }}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"@vitejs/plugin-react-swc": "^3.7.1",
"autoprefixer": "^10.4.18",
"better-npm-audit": "^3.7.3",
"conventional-changelog-conventionalcommits": "^7.0.2",
"conventional-changelog-conventionalcommits": "^8.0.0",
"cpy-cli": "^5.0.0",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
Expand Down Expand Up @@ -197,4 +197,4 @@
"ws@>7.0.0 <7.5.9": "7.5.10",
"path-to-regexp@>= 0.2.0 <8.0.0": "8.0.0"
}
}
}

0 comments on commit 4115f7e

Please sign in to comment.