Skip to content

Re-add AGENTS.md

Re-add AGENTS.md #394

Workflow file for this run

name: Build and Deploy Flutter Web to GitHub Pages
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
# NOTE: This workflow automatically update gh-pages branch and it requires write permissions
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Flutter
run: |
git clone https://github.com/flutter/flutter.git --depth 1 --branch stable ~/flutter
echo "$HOME/flutter/bin" >> $GITHUB_PATH
~/flutter/bin/flutter config --no-enable-android --no-enable-linux-desktop
~/flutter/bin/flutter channel stable
- name: Check Flutter SDK version
run: |
flutter --version
FLUTTER_VERSION=$(flutter --version | head -n 1 | awk '{print $2}')
echo "FLUTTER_VERSION=$FLUTTER_VERSION" >> $GITHUB_ENV
- name: Check pdfrx version
run: |
PDFRX_VERSION=$(awk -F": " '/^version:/ {print $2}' pubspec.yaml)
echo "PDFRX_VERSION=$PDFRX_VERSION" >> $GITHUB_ENV
- name: Install dependencies
run: flutter pub get
- name: Build Flutter Web App (WASM)
run: |
cd packages/pdfrx/example/viewer/
flutter build web --wasm --release --dart-define=GITHUB_COMMIT=$GITHUB_SHA --dart-define=PDFRX_VERSION=$PDFRX_VERSION
sed -i \
-e 's|<base href="/">|<base href="/pdfrx/">|' \
-e "s/__CONFIGS__/pdfrx=${PDFRX_VERSION},commit=${GITHUB_SHA},flutter=${FLUTTER_VERSION}/g" \
build/web/index.html
- name: Configure Git for deployment
run: |
git config user.email "action@github.com"
git config user.name "GitHub Action"
git remote set-url origin https://x-access-token:${{ secrets.TOKEN_FOR_GHPAGE_DEPLOYMENT }}@github.com/${{ github.repository }}.git
- name: Deploy to GitHub Pages using subtree push
run: |
git add -f packages/pdfrx/example/viewer/build/web
git commit -m "$PDFRX_VERSION $GITHUB_SHA"
git subtree split --prefix packages/pdfrx/example/viewer/build/web -b tmp
git push -f origin tmp:gh-pages