Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(snaefell-ui): ui deployment #17227

Merged
merged 10 commits into from
May 20, 2024
44 changes: 44 additions & 0 deletions .github/workflows/snaefell-ui--ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Snaefell UI

on: workflow_call

jobs:
build:
runs-on: [taiko-runner]
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install pnpm dependencies
uses: ./.github/actions/install-pnpm-dependencies
# This step is needed because the .env file is not committed to the repository
# and the Svelte check complains about not finding the exports from $env/static/public,
# which will be generated based on the .env file when running `svelte-kit sync`
- name: Copy .env.example to .env
working-directory: ./packages/snaefell-ui
run: cp .env.example .env

- name: Frontend build
working-directory: ./packages/snaefell-ui
run: pnpm build

- name: Svelte check
working-directory: ./packages/snaefell-ui
run: pnpm check

- name: Check formatting
working-directory: ./packages/snaefell-ui
run: pnpm lint

- name: Unit tests
env:
SKIP_ENV_VALIDATION: "true"
working-directory: ./packages/snaefell-ui
run: pnpm test:unit
40 changes: 40 additions & 0 deletions .github/workflows/snaefell-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Snaefell UI CI/CD

on:
push:
branches-ignore:
- release-please-*
paths:
- "packages/snaefell-ui/**"
pull_request:
paths:
- "packages/snaefell-ui/**"

jobs:
build-and-test:
uses: ./.github/workflows/snaefell-ui--ci.yml

# Deployment name follow the pattern: deploy_<appname(snaefell-ui)>_<network(devnet|hekla|mainnet)>_<environment(preview|production)>
deploy_snaefell-ui_mainnet_preview:
if: ${{ github.ref_name != 'main' }}
needs: build-and-test
uses: ./.github/workflows/repo--vercel-deploy.yml
with:
environment: "preview"
flags: ""
secrets:
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID_TAIKOON_UI_MAINNET }}
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
vercel_token: ${{ secrets.VERCEL_TOKEN }}

deploy_snaefell-ui_mainnet_production:
if: ${{ github.ref_name == 'main' && contains(github.ref, 'refs/tags/snaefell-ui-') }}
needs: build-and-test
uses: ./.github/workflows/repo--vercel-deploy.yml
with:
environment: "production"
flags: "--prod"
secrets:
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID_TAIKOON_UI_MAINNET }}
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
vercel_token: ${{ secrets.VERCEL_TOKEN }}
1 change: 1 addition & 0 deletions packages/snaefell-ui/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BAR=FOO
6 changes: 5 additions & 1 deletion packages/snaefell-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "echo 'Unimplemented'",
"check": "echo 'Unimplemented'",
"lint": "echo 'Unimplemented'",
"test:unit": "echo 'Unimplemented'"
},
"author": "",
"license": "ISC"
Expand Down