From 5eaaeae08c6f25256b69c63c2281f4bcf2e39cef Mon Sep 17 00:00:00 2001 From: Gustavo Valverde Date: Wed, 16 Aug 2023 23:16:55 +0100 Subject: [PATCH] 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 --- .github/workflows/docs.yml | 36 +++++++++++++++++++----------------- firebase.json | 4 ++-- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9c7ee5aa..5d0be7e4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,6 +16,7 @@ on: # doc source files - 'book/**' - '**/firebase.json' + - '**/.firebaserc' - 'katex-header.html' # rustdoc source files - '**/*.rs' @@ -34,6 +35,7 @@ on: # doc source files - 'book/**' - '**/firebase.json' + - '**/.firebaserc' - 'katex-header.html' # rustdoc source files - '**/*.rs' @@ -57,7 +59,6 @@ jobs: name: Build and Deploy Zebra Book Docs timeout-minutes: 5 runs-on: ubuntu-latest - environment: docs permissions: checks: write contents: 'read' @@ -91,24 +92,24 @@ jobs: service_account: '${{ vars.GCP_FIREBASE_SA }}' # 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 - 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 uses: FirebaseExtended/action-hosting-deploy@v0.7.1 with: repoToken: ${{ secrets.GITHUB_TOKEN }} - firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA }} + firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA_PATH }} channelId: ${{ env.FIREBASE_CHANNEL }} - projectId: ${{ vars.GCP_PROJECT }} + projectId: ${{ vars.GCP_FIREBASE_PROJECT }} target: docs-book build-docs-external: name: Build and Deploy Zebra External Docs timeout-minutes: 45 runs-on: ubuntu-latest - environment: docs permissions: checks: write contents: 'read' @@ -136,7 +137,7 @@ jobs: - name: Build external docs run: | # 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: RUSTDOCFLAGS: '--html-in-header katex-header.html' @@ -150,24 +151,24 @@ jobs: service_account: '${{ vars.GCP_FIREBASE_SA }}' # 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 - 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 uses: FirebaseExtended/action-hosting-deploy@v0.7.1 with: repoToken: ${{ secrets.GITHUB_TOKEN }} - firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA }} + firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA_PATH }} channelId: ${{ env.FIREBASE_CHANNEL }} target: docs-external - projectId: ${{ vars.GCP_PROJECT }} + projectId: ${{ vars.GCP_FIREBASE_PROJECT }} build-docs-internal: name: Build and Deploy Zebra Internal Docs timeout-minutes: 45 runs-on: ubuntu-latest - environment: docs permissions: checks: write contents: 'read' @@ -194,7 +195,7 @@ jobs: - name: Build internal docs 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: RUSTDOCFLAGS: '--html-in-header katex-header.html' @@ -208,15 +209,16 @@ jobs: service_account: '${{ vars.GCP_FIREBASE_SA }}' # 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 - 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 uses: FirebaseExtended/action-hosting-deploy@v0.7.1 with: repoToken: ${{ secrets.GITHUB_TOKEN }} - firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA }} + firebaseServiceAccount: ${{ env.GCP_FIREBASE_SA_PATH }} channelId: ${{ env.FIREBASE_CHANNEL }} target: docs-internal - projectId: ${{ vars.GCP_PROJECT }} + projectId: ${{ vars.GCP_FIREBASE_PROJECT }} diff --git a/firebase.json b/firebase.json index 7dd48adf..cb5e45db 100644 --- a/firebase.json +++ b/firebase.json @@ -1,7 +1,7 @@ { "hosting": [ { - "public": "target/external", + "public": "target/external/doc", "target": "docs-external", "ignore": [ "firebase.json", @@ -23,7 +23,7 @@ ] }, { - "public": "target/internal", + "public": "target/internal/doc", "target": "docs-internal", "ignore": [ "firebase.json",