Add: Host Redirect #184
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
name: Stage site on Firebase | |
on: | |
pull_request: | |
branches: | |
- main | |
# Declare default permissions as read only. | |
permissions: read-all | |
env: | |
NODE_VERSION: 20 | |
jobs: | |
stage: | |
permissions: | |
contents: read | |
checks: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.head.repo.full_name == 'cfug/flutter.cn' }} | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 | |
with: | |
submodules: recursive | |
- name: Enable Corepack | |
run: corepack enable | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'pnpm' | |
- name: Setup pnpm | |
run: corepack install | |
- name: Install node dependencies | |
run: pnpm install --frozen-lockfile | |
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 | |
with: | |
sdk: stable | |
- name: Fetch Dart dependencies | |
run: dart pub get | |
- name: Build site | |
run: dart run flutter_site build | |
- name: Translated (docs.flutter.cn) | |
run: bash tool/translator/build.sh | |
shell: bash | |
- name: Stage | |
if: ${{ | |
github.repository == 'cfug/flutter.cn' && | |
github.event.pull_request.user.login != 'dependabot[bot]' }} | |
uses: cfug/doc-site-preview-in-pr@main | |
with: | |
repoToken: '${{ secrets.GITHUB_TOKEN }}' | |
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_FLUTTER_CN_DOCS_PROD }}' | |
expires: 14d | |
projectId: flutter-cn-docs-prod | |
showDetailedUrls: true | |
fileExtensionFilter: "md, html" |