Added 404 page to handle redirect #40
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
paths: | |
- "**/*.dart" | |
- "**/*.html" | |
- "**/*.js" | |
- "**/*.css" | |
- "**/*.png" | |
- "**/*.svg" | |
name: Deploy PR on Github Pages | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
deploy: | |
name: Build web version and deploy | |
runs-on: ubuntu-latest | |
environment: | |
name: PR-${{ github.event.pull_request.number }} | |
url: ${{ steps.configure.outputs.URL }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.10.6" | |
channel: "stable" | |
cache: true | |
cache-key: deps-${{ hashFiles('**/pubspec.lock') }} # optional, change this to force refresh cache | |
cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path | |
- name: Run prebuild | |
run: bash prebuild.sh | |
- name: Configure environments | |
id: configure | |
env: | |
FOLDER: ${{ github.event.pull_request.number }} | |
run: | | |
sed -i "s|SERVER_URL=.*|SERVER_URL=https://apisix.upn.integration-open-paas.org/|g" env.file | |
sed -i "s|DOMAIN_REDIRECT_URL=.*|DOMAIN_REDIRECT_URL=https://tmail-preview.lin-saas.dev/$FOLDER|g" env.file | |
echo "URL=https://tmail-preview.lin-saas.dev/$FOLDER" >> $GITHUB_OUTPUT | |
- name: Build | |
env: | |
FOLDER: ${{ github.event.pull_request.number }} | |
run: | | |
flutter build web --profile --verbose --base-href "/$FOLDER/" | |
cp build/web/index.html build/web/404.html | |
- name: Deploy to Github Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
destination_dir: ${{ github.event.pull_request.number }} | |
keep_files: true | |
publish_dir: "build/web" | |
- name: Find deployment comment | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
comment-author: "github-actions[bot]" | |
issue-number: ${{ github.event.pull_request.number }} | |
body-includes: "This PR has been deployed to" | |
- name: Create or update deployment comment | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
This PR has been deployed to ${{ steps.configure.outputs.URL }}. | |
edit-mode: replace |