fix(docs): deploy external and internal docs with the correct path (#7338)

* fix(docs): use specific variables to avoid using  an `environment`

* fix(docs): build and publish the correct paths

* fix(docs): remove all environments
This commit is contained in:
Gustavo Valverde 2023-08-16 23:16:55 +01:00 committed by GitHub
parent b0003076c3
commit 5eaaeae08c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 19 deletions

View File

@ -16,6 +16,7 @@ on:
# doc source files # doc source files
- 'book/**' - 'book/**'
- '**/firebase.json' - '**/firebase.json'
- '**/.firebaserc'
- 'katex-header.html' - 'katex-header.html'
# rustdoc source files # rustdoc source files
- '**/*.rs' - '**/*.rs'
@ -34,6 +35,7 @@ on:
# doc source files # doc source files
- 'book/**' - 'book/**'
- '**/firebase.json' - '**/firebase.json'
- '**/.firebaserc'
- 'katex-header.html' - 'katex-header.html'
# rustdoc source files # rustdoc source files
- '**/*.rs' - '**/*.rs'
@ -57,7 +59,6 @@ jobs:
name: Build and Deploy Zebra Book Docs name: Build and Deploy Zebra Book Docs
timeout-minutes: 5 timeout-minutes: 5
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: docs
permissions: permissions:
checks: write checks: write
contents: 'read' contents: 'read'
@ -91,24 +92,24 @@ jobs:
service_account: '${{ vars.GCP_FIREBASE_SA }}' service_account: '${{ vars.GCP_FIREBASE_SA }}'
# TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed # TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed
- run: | - name: Add $GCP_FIREBASE_SA_PATH to env
run: |
# shellcheck disable=SC2002 # shellcheck disable=SC2002
echo "GCP_FIREBASE_SA=$(cat ${{ steps.auth.outputs.credentials_file_path }} | tr -d '\n')" >> "$GITHUB_ENV" echo "GCP_FIREBASE_SA_PATH=$(cat ${{ steps.auth.outputs.credentials_file_path }} | tr -d '\n')" >> "$GITHUB_ENV"
- name: Deploy Zebra book to firebase - name: Deploy Zebra book to firebase
uses: FirebaseExtended/action-hosting-deploy@v0.7.1 uses: FirebaseExtended/action-hosting-deploy@v0.7.1
with: with:
repoToken: ${{ secrets.GITHUB_TOKEN }} repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA }} firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA_PATH }}
channelId: ${{ env.FIREBASE_CHANNEL }} channelId: ${{ env.FIREBASE_CHANNEL }}
projectId: ${{ vars.GCP_PROJECT }} projectId: ${{ vars.GCP_FIREBASE_PROJECT }}
target: docs-book target: docs-book
build-docs-external: build-docs-external:
name: Build and Deploy Zebra External Docs name: Build and Deploy Zebra External Docs
timeout-minutes: 45 timeout-minutes: 45
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: docs
permissions: permissions:
checks: write checks: write
contents: 'read' contents: 'read'
@ -136,7 +137,7 @@ jobs:
- name: Build external docs - name: Build external docs
run: | run: |
# Exclude zebra-utils, it is not for library or app users # Exclude zebra-utils, it is not for library or app users
cargo doc --no-deps --workspace --all-features --exclude zebra-utils --target-dir target/external cargo doc --no-deps --workspace --all-features --exclude zebra-utils --target-dir "$(pwd)"/target/external
env: env:
RUSTDOCFLAGS: '--html-in-header katex-header.html' RUSTDOCFLAGS: '--html-in-header katex-header.html'
@ -150,24 +151,24 @@ jobs:
service_account: '${{ vars.GCP_FIREBASE_SA }}' service_account: '${{ vars.GCP_FIREBASE_SA }}'
# TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed # TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed
- run: | - name: Add $GCP_FIREBASE_SA_PATH to env
run: |
# shellcheck disable=SC2002 # shellcheck disable=SC2002
echo "GCP_FIREBASE_SA=$(cat ${{ steps.auth.outputs.credentials_file_path }} | tr -d '\n')" >> "$GITHUB_ENV" echo "GCP_FIREBASE_SA_PATH=$(cat ${{ steps.auth.outputs.credentials_file_path }} | tr -d '\n')" >> "$GITHUB_ENV"
- name: Deploy external docs to firebase - name: Deploy external docs to firebase
uses: FirebaseExtended/action-hosting-deploy@v0.7.1 uses: FirebaseExtended/action-hosting-deploy@v0.7.1
with: with:
repoToken: ${{ secrets.GITHUB_TOKEN }} repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA }} firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA_PATH }}
channelId: ${{ env.FIREBASE_CHANNEL }} channelId: ${{ env.FIREBASE_CHANNEL }}
target: docs-external target: docs-external
projectId: ${{ vars.GCP_PROJECT }} projectId: ${{ vars.GCP_FIREBASE_PROJECT }}
build-docs-internal: build-docs-internal:
name: Build and Deploy Zebra Internal Docs name: Build and Deploy Zebra Internal Docs
timeout-minutes: 45 timeout-minutes: 45
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: docs
permissions: permissions:
checks: write checks: write
contents: 'read' contents: 'read'
@ -194,7 +195,7 @@ jobs:
- name: Build internal docs - name: Build internal docs
run: | run: |
cargo doc --no-deps --workspace --all-features --document-private-items --target-dir target/internal cargo doc --no-deps --workspace --all-features --document-private-items --target-dir "$(pwd)"/target/internal
env: env:
RUSTDOCFLAGS: '--html-in-header katex-header.html' RUSTDOCFLAGS: '--html-in-header katex-header.html'
@ -208,15 +209,16 @@ jobs:
service_account: '${{ vars.GCP_FIREBASE_SA }}' service_account: '${{ vars.GCP_FIREBASE_SA }}'
# TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed # TODO: remove this step after issue https://github.com/FirebaseExtended/action-hosting-deploy/issues/174 is fixed
- run: | - name: Add $GCP_FIREBASE_SA_PATH to env
run: |
# shellcheck disable=SC2002 # shellcheck disable=SC2002
echo "GCP_FIREBASE_SA=$(cat ${{ steps.auth.outputs.credentials_file_path }} | tr -d '\n')" >> "$GITHUB_ENV" echo "GCP_FIREBASE_SA_PATH=$(cat ${{ steps.auth.outputs.credentials_file_path }} | tr -d '\n')" >> "$GITHUB_ENV"
- name: Deploy internal docs to firebase - name: Deploy internal docs to firebase
uses: FirebaseExtended/action-hosting-deploy@v0.7.1 uses: FirebaseExtended/action-hosting-deploy@v0.7.1
with: with:
repoToken: ${{ secrets.GITHUB_TOKEN }} repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA }} firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA_PATH }}
channelId: ${{ env.FIREBASE_CHANNEL }} channelId: ${{ env.FIREBASE_CHANNEL }}
target: docs-internal target: docs-internal
projectId: ${{ vars.GCP_PROJECT }} projectId: ${{ vars.GCP_FIREBASE_PROJECT }}

View File

@ -1,7 +1,7 @@
{ {
"hosting": [ "hosting": [
{ {
"public": "target/external", "public": "target/external/doc",
"target": "docs-external", "target": "docs-external",
"ignore": [ "ignore": [
"firebase.json", "firebase.json",
@ -23,7 +23,7 @@
] ]
}, },
{ {
"public": "target/internal", "public": "target/internal/doc",
"target": "docs-internal", "target": "docs-internal",
"ignore": [ "ignore": [
"firebase.json", "firebase.json",