From 5ba72106908d0a63d33fa028f08246bed741ffa5 Mon Sep 17 00:00:00 2001 From: Don Setiawan Date: Wed, 27 Nov 2024 14:28:03 -0800 Subject: [PATCH] build: Add build for web version and host in gh-pages (#206) * build: Add build for web version and host in gh-pages * fix: Remove PR run and change job name * refactor: Tweak build path to relative with working directory --- .github/workflows/web-main.yaml | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/web-main.yaml diff --git a/.github/workflows/web-main.yaml b/.github/workflows/web-main.yaml new file mode 100644 index 0000000..2cb1ec5 --- /dev/null +++ b/.github/workflows/web-main.yaml @@ -0,0 +1,52 @@ +name: web + +on: + push: + branches: + - main + workflow_dispatch: + + +jobs: + call-run-server: + uses: uw-ssec/post-disaster-comms/.github/workflows/run-dev-server.yml@main + build-and-publish: + runs-on: ubuntu-latest + # This workflow accesses secrets and checks out a PR, so only run if labelled + # https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ + # if: contains(github.event.pull_request.labels.*.name, 'preview') + defaults: + run: + working-directory: ./src/support_sphere + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + - run: flutter pub get + # original values are in deployment/values.cloud.yaml + - run: flutter build web --web-renderer html --dart-define=SUPABASE_ANON_KEY=${{ secrets.CLOUD_DB_JWT_ANON_KEY}} --dart-define=SUPABASE_URL=${{ secrets.CLOUD_DB_URL}} + + - name: Upload Pages HTML + uses: actions/upload-pages-artifact@v3 + with: + path: build/web + + - name: Setup GitHub Pages + uses: actions/configure-pages@v5 + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + + - name: Upload Complete Build Folder + if: always() + uses: actions/upload-artifact@v4 + with: + name: build-${{ runner.os }} + path: build/web/