From c80a216662e9a79d30b13a3ff875b8336fc0efe6 Mon Sep 17 00:00:00 2001 From: Louisa Chu Date: Mon, 3 Nov 2025 15:25:21 -0800 Subject: [PATCH 1/2] update deploy issue with the shared workflow. --- .github/workflows/algolia-indexing.yml | 51 ----- .github/workflows/deploy.yml | 263 ++---------------------- .github/workflows/test-pull-request.yml | 19 +- 3 files changed, 16 insertions(+), 317 deletions(-) delete mode 100644 .github/workflows/algolia-indexing.yml diff --git a/.github/workflows/algolia-indexing.yml b/.github/workflows/algolia-indexing.yml deleted file mode 100644 index 173d58c..0000000 --- a/.github/workflows/algolia-indexing.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -name: Search Indexing -on: - workflow_dispatch: - inputs: - mode: - description: 'Type of indexing. "index" to push to Algolia, "console" for dry run.' - required: true - default: "index" - type: choice - options: - - console - - index - -jobs: - build-and-index: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node v18 for Yarn v4 - uses: actions/setup-node@v3 - with: - node-version: "18.19.0" # Current LTS version - - - name: Enable Corepack for Yarn - run: corepack enable - - - name: Install Dependencies - run: yarn install - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: false - - - name: Build site - run: yarn build - - env: - NODE_OPTIONS: "--max_old_space_size=8192" - PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build' - REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO_OWNER: ${{ github.repository_owner }} - REPO_NAME: ${{ github.event.repository.name }} - REPO_BRANCH: ${{ github.ref_name }} - GATSBY_ALGOLIA_APPLICATION_ID: ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }} - GATSBY_ALGOLIA_SEARCH_API_KEY: ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }} - ALGOLIA_WRITE_API_KEY: ${{ secrets.AIO_ALGOLIA_WRITE_API_KEY }} - ALGOLIA_INDEXATION_MODE: ${{ github.event.inputs.mode || 'index' }} - GATSBY_ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME || github.event.repository.name }} - GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }} - GATSBY_SITE_DOMAIN_URL: https://developer.adobe.com diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8a7d6e7..78b5a43 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,9 +8,10 @@ on: required: true default: "dev" clean: - description: "Clean cache (yes|no)" + description: "Clean cache" required: true - default: "no" + type: boolean + default: false excludeSubfolder: description: "Exclude a subfolder from deletion" required: false @@ -24,251 +25,13 @@ on: - console - index jobs: - set-state: - runs-on: ubuntu-latest - outputs: - deploy_prod: ${{ contains(github.event.inputs.env, 'prod') }} - deploy_dev: ${{ contains(github.event.inputs.env, 'dev') }} - clean_cache: ${{ contains(github.event.inputs.clean, 'yes') }} - path_prefix: ${{ steps.get_path_prefix.outputs.path_prefix }} - branch_short_ref: ${{ steps.get_branch.outputs.branch }} - exclude_subfolder: ${{ github.event.inputs.excludeSubfolder }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Get pathPrefix - uses: actions/github-script@v6 - id: get_path_prefix - with: - script: | - const script = require('./.github/scripts/get-path-prefix.js'); - script({ core }); - result-encoding: string - - name: Get branch name - shell: bash - run: echo "branch=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT" - id: get_branch - - echo-state: - needs: [set-state] - runs-on: ubuntu-latest - steps: - - run: echo "Deploy to dev - ${{ needs.set-state.outputs.deploy_dev }}" - - run: echo "Deploy to prod - ${{ needs.set-state.outputs.deploy_prod }}" - - run: echo "Clean cache - ${{ needs.set-state.outputs.clean_cache }}" - - run: echo "Repository org - ${{ github.event.repository.owner.login }}" - - run: echo "Repository name - ${{ github.event.repository.name }}" - - run: echo "Repository branch - ${{ needs.set-state.outputs.branch_short_ref }}" - - run: echo "Path prefix - ${{ needs.set-state.outputs.path_prefix }}" - - run: echo "Exclude subfolder - ${{ needs.set-state.outputs.exclude_subfolder }}" - - pre-build-dev: - needs: [set-state] - runs-on: ubuntu-latest - if: needs.set-state.outputs.deploy_dev == 'true' - steps: - - name: check dev azure connection string - if: env.AIO_AZURE_DEV_CONNECTION_STRING == null - run: | - echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_DEV_CONNECTION_STRING in Github Secrets" - exit 1 - env: - AIO_AZURE_DEV_CONNECTION_STRING: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }} - - build-dev: - defaults: - run: - shell: bash - needs: [set-state, pre-build-dev] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Node v20 for Yarn v3 - uses: actions/setup-node@v3 - with: - node-version: "20.19.5" # Current LTS version - - - name: Enable Corepack for Yarn v3 - run: corepack enable - - - name: Install Yarn v3 - uses: borales/actions-yarn@v3 - with: - cmd: set version stable - - - name: Install Dependencies - uses: borales/actions-yarn@v3 - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: false - with: - cmd: install - - - name: Gatsby Cache - uses: actions/cache@v3 - with: - path: | - public - .cache - key: ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }} - restore-keys: | - ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache- - - - name: Clean Cache - if: needs.set-state.outputs.clean_cache == 'true' - uses: borales/actions-yarn@v3 - with: - cmd: clean - - - name: Build site - uses: borales/actions-yarn@v3 - with: - cmd: build - env: - PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build' - PATH_PREFIX: ${{ needs.set-state.outputs.path_prefix }} - GATSBY_ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_DEV_SRC }} - GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS: ${{ secrets.AIO_REPORT_SUITE_DEV}} - GATSBY_ADOBE_ANALYTICS_ENV: "dev" - REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO_OWNER: ${{ github.event.repository.owner.login }} - REPO_NAME: ${{ github.event.repository.name }} - REPO_BRANCH: ${{ needs.set-state.outputs.branch_short_ref }} - GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }} - GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }} - GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }} - GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }} - GATSBY_IMS_SRC: ${{ secrets.AIO_IMS_DEV_SRC }} - GATSBY_IMS_CONFIG: ${{ secrets.AIO_IMS_DEV_CONFIG }} - GATSBY_ALGOLIA_APPLICATION_ID: ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }} - GATSBY_ALGOLIA_SEARCH_API_KEY: ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }} - GATSBY_ALGOLIA_APP_ID: ${{ secrets.AIO_ALGOLIA_APP_ID }} - GATSBY_ALGOLIA_API_KEY: ${{ secrets.AIO_ALGOLIA_API_KEY }} - GATSBY_ALGOLIA_INDEX_ALL_SRC: ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }} - GATSBY_ALGOLIA_SEARCH_INDEX: ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }} - GATSBY_ALGOLIA_INDEX_ENV_PREFIX: ${{ secrets.AIO_ALGOLIA_INDEX_ENV_PREFIX }} - GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }} - GATSBY_SITE_DOMAIN_URL: https://developer-stage.adobe.com - - - name: Deploy - uses: AdobeDocs/static-website-deploy@master - with: - enabled-static-website: "true" - source: "public" - target: ${{ needs.set-state.outputs.path_prefix }} - connection-string: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }} - remove-existing-files: "true" - exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }} - - name: Purge Fastly Cache - uses: AdobeDocs/gatsby-fastly-purge-action@master - with: - fastly-token: ${{ secrets.AIO_FASTLY_TOKEN }} - fastly-url: "${{ secrets.AIO_FASTLY_DEV_URL}}${{ needs.set-state.outputs.path_prefix }}" - - pre-build-production: - needs: [set-state] - runs-on: ubuntu-latest - if: needs.set-state.outputs.deploy_prod == 'true' - steps: - - name: check prod azure connection string - if: env.AIO_AZURE_PROD_CONNECTION_STRING == null - run: | - echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_PROD_CONNECTION_STRING in Github Secrets" - exit 1 - env: - AIO_AZURE_PROD_CONNECTION_STRING: ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }} - - build-production: - defaults: - run: - shell: bash - needs: [set-state, pre-build-production] - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Node v20 for Yarn v3 - uses: actions/setup-node@v3 - with: - node-version: "20.19.5" # Current LTS version - - - name: Enable Corepack for Yarn v3 - run: corepack enable - - - name: Install Yarn v3 - uses: borales/actions-yarn@v3 - with: - cmd: set version stable - - - name: Install Dependencies - uses: borales/actions-yarn@v3 - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: false - with: - cmd: install - - - name: Gatsby Cache - uses: actions/cache@v3 - with: - path: | - public - .cache - key: ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }} - restore-keys: | - ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache- - - - name: Clean Cache - if: needs.set-state.outputs.clean_cache == 'true' - uses: borales/actions-yarn@v3 - with: - cmd: clean - - - name: Build site - uses: borales/actions-yarn@v3 - with: - cmd: build - env: - PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build' - PATH_PREFIX: ${{ needs.set-state.outputs.path_prefix }} - GATSBY_ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_PROD_SRC }} - GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS: ${{ secrets.AIO_REPORT_SUITE_PROD }} - GATSBY_ADOBE_ANALYTICS_ENV: "production" - REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO_OWNER: ${{ github.event.repository.owner.login }} - REPO_NAME: ${{ github.event.repository.name }} - REPO_BRANCH: ${{ needs.set-state.outputs.branch_short_ref }} - GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }} - GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }} - GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }} - GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }} - GATSBY_IMS_SRC: ${{ secrets.AIO_IMS_PROD_SRC }} - GATSBY_IMS_CONFIG: ${{ secrets.AIO_IMS_PROD_CONFIG }} - GATSBY_ALGOLIA_APPLICATION_ID: ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }} - GATSBY_ALGOLIA_SEARCH_API_KEY: ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }} - GATSBY_ALGOLIA_APP_ID: ${{ secrets.AIO_ALGOLIA_APP_ID }} - GATSBY_ALGOLIA_API_KEY: ${{ secrets.AIO_ALGOLIA_API_KEY }} - ALGOLIA_WRITE_API_KEY: ${{ secrets.AIO_ALGOLIA_WRITE_API_KEY }} - ALGOLIA_INDEXATION_MODE: ${{ github.event.inputs.index-mode || 'index' }} - GATSBY_ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME || github.event.repository.name }} - GATSBY_ALGOLIA_INDEX_ALL_SRC: ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }} - GATSBY_ALGOLIA_SEARCH_INDEX: ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }} - GATSBY_ALGOLIA_INDEX_ENV_PREFIX: ${{ secrets.AIO_ALGOLIA_INDEX_ENV_PREFIX }} - GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }} - GATSBY_SITE_DOMAIN_URL: https://developer.adobe.com - - name: Deploy - uses: AdobeDocs/static-website-deploy@master - with: - enabled-static-website: "true" - source: "public" - target: ${{ needs.set-state.outputs.path_prefix }} - connection-string: ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }} - remove-existing-files: "true" - exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }} - - name: Purge Fastly Cache - uses: AdobeDocs/gatsby-fastly-purge-action@master - with: - fastly-token: ${{ secrets.AIO_FASTLY_TOKEN }} - fastly-url: "${{ secrets.AIO_FASTLY_PROD_URL }}${{ needs.set-state.outputs.path_prefix }}" + deployment: + name: Deployment + uses: AdobeDocs/adp-devsite-workflow/.github/workflows/gatsby-deploy.yml@main + secrets: inherit + with: + env: ${{ inputs.env }} + clean: ${{ inputs.clean }} + excludeSubfolder: ${{ inputs.excludeSubfolder }} + index-mode: ${{ inputs.index-mode }} + NODE_OPTIONS: "--max-old-space-size=8192" diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index 115c3d0..a9eb4b1 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -65,25 +65,12 @@ jobs: - name: Enable Corepack for Yarn v3 run: corepack enable - - name: Install Yarn v3 - uses: borales/actions-yarn@v3 - with: - cmd: set version stable - - name: Install dependencies - uses: borales/actions-yarn@v3 - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: false - with: - cmd: install + run: yarn install - name: Check internal links - uses: borales/actions-yarn@v3 - with: - cmd: test:links + run: yarn test:links - name: Build site if: ${{ success() }} - uses: borales/actions-yarn@v3 - with: - cmd: build + run: yarn build From cd87423e362f1d0931b05350f24e2069344a3ed3 Mon Sep 17 00:00:00 2001 From: Louisa Chu Date: Tue, 4 Nov 2025 11:30:03 -0800 Subject: [PATCH 2/2] roll back to not use shared script --- .github/workflows/deploy.yml | 237 +++++++++++++++++++++++++++++++++-- 1 file changed, 224 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 78b5a43..f89dc0d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,10 +8,9 @@ on: required: true default: "dev" clean: - description: "Clean cache" + description: "Clean cache (yes|no)" required: true - type: boolean - default: false + default: "no" excludeSubfolder: description: "Exclude a subfolder from deletion" required: false @@ -25,13 +24,225 @@ on: - console - index jobs: - deployment: - name: Deployment - uses: AdobeDocs/adp-devsite-workflow/.github/workflows/gatsby-deploy.yml@main - secrets: inherit - with: - env: ${{ inputs.env }} - clean: ${{ inputs.clean }} - excludeSubfolder: ${{ inputs.excludeSubfolder }} - index-mode: ${{ inputs.index-mode }} - NODE_OPTIONS: "--max-old-space-size=8192" + set-state: + runs-on: ubuntu-latest + outputs: + deploy_prod: ${{ contains(github.event.inputs.env, 'prod') }} + deploy_dev: ${{ contains(github.event.inputs.env, 'dev') }} + clean_cache: ${{ contains(github.event.inputs.clean, 'yes') }} + path_prefix: ${{ steps.get_path_prefix.outputs.path_prefix }} + branch_short_ref: ${{ steps.get_branch.outputs.branch }} + exclude_subfolder: ${{ github.event.inputs.excludeSubfolder }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get pathPrefix + uses: actions/github-script@v7 + id: get_path_prefix + with: + script: | + const script = require('./.github/scripts/get-path-prefix.js'); + script({ core }); + result-encoding: string + - name: Get branch name + shell: bash + run: echo "branch=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT" + id: get_branch + + echo-state: + needs: [set-state] + runs-on: ubuntu-latest + steps: + - run: echo "Deploy to dev - ${{ needs.set-state.outputs.deploy_dev }}" + - run: echo "Deploy to prod - ${{ needs.set-state.outputs.deploy_prod }}" + - run: echo "Clean cache - ${{ needs.set-state.outputs.clean_cache }}" + - run: echo "Repository org - ${{ github.event.repository.owner.login }}" + - run: echo "Repository name - ${{ github.event.repository.name }}" + - run: echo "Repository branch - ${{ needs.set-state.outputs.branch_short_ref }}" + - run: echo "Path prefix - ${{ needs.set-state.outputs.path_prefix }}" + - run: echo "Exclude subfolder - ${{ needs.set-state.outputs.exclude_subfolder }}" + + pre-build-dev: + needs: [set-state] + runs-on: ubuntu-latest + if: needs.set-state.outputs.deploy_dev == 'true' + steps: + - name: check dev azure connection string + if: env.AIO_AZURE_DEV_CONNECTION_STRING == null + run: | + echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_DEV_CONNECTION_STRING in Github Secrets" + exit 1 + env: + AIO_AZURE_DEV_CONNECTION_STRING: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }} + + build-dev: + defaults: + run: + shell: bash + needs: [set-state, pre-build-dev] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node v20 for Yarn v3 + uses: actions/setup-node@v3 + with: + node-version: "20.19.5" # Current LTS version + + - name: Enable Corepack for Yarn v3 + run: corepack enable + + - name: Install Dependencies + run: yarn install + + - name: Gatsby Cache + uses: actions/cache@v3 + with: + path: | + public + .cache + key: ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }} + restore-keys: | + ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache- + + - name: Clean Cache + if: needs.set-state.outputs.clean_cache == 'true' + run: yarn clean + + - name: Build site + run: yarn build + env: + PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build' + PATH_PREFIX: ${{ needs.set-state.outputs.path_prefix }} + GATSBY_ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_DEV_SRC }} + GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS: ${{ secrets.AIO_REPORT_SUITE_DEV}} + GATSBY_ADOBE_ANALYTICS_ENV: "dev" + REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO_OWNER: ${{ github.event.repository.owner.login }} + REPO_NAME: ${{ github.event.repository.name }} + REPO_BRANCH: ${{ needs.set-state.outputs.branch_short_ref }} + GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }} + GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }} + GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }} + GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }} + GATSBY_IMS_SRC: ${{ secrets.AIO_IMS_DEV_SRC }} + GATSBY_IMS_CONFIG: ${{ secrets.AIO_IMS_DEV_CONFIG }} + GATSBY_ALGOLIA_APPLICATION_ID: ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }} + GATSBY_ALGOLIA_SEARCH_API_KEY: ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }} + GATSBY_ALGOLIA_APP_ID: ${{ secrets.AIO_ALGOLIA_APP_ID }} + GATSBY_ALGOLIA_API_KEY: ${{ secrets.AIO_ALGOLIA_API_KEY }} + GATSBY_ALGOLIA_INDEX_ALL_SRC: ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }} + GATSBY_ALGOLIA_SEARCH_INDEX: ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }} + GATSBY_ALGOLIA_INDEX_ENV_PREFIX: ${{ secrets.AIO_ALGOLIA_INDEX_ENV_PREFIX }} + GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }} + GATSBY_SITE_DOMAIN_URL: https://developer-stage.adobe.com + + - name: Deploy + uses: AdobeDocs/static-website-deploy@master + with: + enabled-static-website: "true" + source: "public" + target: ${{ needs.set-state.outputs.path_prefix }} + connection-string: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }} + remove-existing-files: "true" + exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }} + - name: Purge Fastly Cache + uses: AdobeDocs/gatsby-fastly-purge-action@master + with: + fastly-token: ${{ secrets.AIO_FASTLY_TOKEN }} + fastly-url: "${{ secrets.AIO_FASTLY_DEV_URL}}${{ needs.set-state.outputs.path_prefix }}" + + pre-build-production: + needs: [set-state] + runs-on: ubuntu-latest + if: needs.set-state.outputs.deploy_prod == 'true' + steps: + - name: check prod azure connection string + if: env.AIO_AZURE_PROD_CONNECTION_STRING == null + run: | + echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_PROD_CONNECTION_STRING in Github Secrets" + exit 1 + env: + AIO_AZURE_PROD_CONNECTION_STRING: ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }} + + build-production: + defaults: + run: + shell: bash + needs: [set-state, pre-build-production] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node v20 for Yarn v3 + uses: actions/setup-node@v3 + with: + node-version: "20.19.5" # Current LTS version + + - name: Enable Corepack for Yarn v3 + run: corepack enable + + - name: Install Dependencies + run: yarn install + + - name: Gatsby Cache + uses: actions/cache@v3 + with: + path: | + public + .cache + key: ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }} + restore-keys: | + ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache- + + - name: Clean Cache + if: needs.set-state.outputs.clean_cache == 'true' + run: yarn clean + + - name: Build site + run: yarn build + env: + PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build' + PATH_PREFIX: ${{ needs.set-state.outputs.path_prefix }} + GATSBY_ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_PROD_SRC }} + GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS: ${{ secrets.AIO_REPORT_SUITE_PROD }} + GATSBY_ADOBE_ANALYTICS_ENV: "production" + REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO_OWNER: ${{ github.event.repository.owner.login }} + REPO_NAME: ${{ github.event.repository.name }} + REPO_BRANCH: ${{ needs.set-state.outputs.branch_short_ref }} + GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }} + GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }} + GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }} + GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }} + GATSBY_IMS_SRC: ${{ secrets.AIO_IMS_PROD_SRC }} + GATSBY_IMS_CONFIG: ${{ secrets.AIO_IMS_PROD_CONFIG }} + GATSBY_ALGOLIA_APPLICATION_ID: ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }} + GATSBY_ALGOLIA_SEARCH_API_KEY: ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }} + GATSBY_ALGOLIA_APP_ID: ${{ secrets.AIO_ALGOLIA_APP_ID }} + GATSBY_ALGOLIA_API_KEY: ${{ secrets.AIO_ALGOLIA_API_KEY }} + ALGOLIA_WRITE_API_KEY: ${{ secrets.AIO_ALGOLIA_WRITE_API_KEY }} + ALGOLIA_INDEXATION_MODE: ${{ github.event.inputs.index-mode || 'index' }} + GATSBY_ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME || github.event.repository.name }} + GATSBY_ALGOLIA_INDEX_ALL_SRC: ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }} + GATSBY_ALGOLIA_SEARCH_INDEX: ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }} + GATSBY_ALGOLIA_INDEX_ENV_PREFIX: ${{ secrets.AIO_ALGOLIA_INDEX_ENV_PREFIX }} + GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }} + GATSBY_SITE_DOMAIN_URL: https://developer.adobe.com + - name: Deploy + uses: AdobeDocs/static-website-deploy@master + with: + enabled-static-website: "true" + source: "public" + target: ${{ needs.set-state.outputs.path_prefix }} + connection-string: ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }} + remove-existing-files: "true" + exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }} + - name: Purge Fastly Cache + uses: AdobeDocs/gatsby-fastly-purge-action@master + with: + fastly-token: ${{ secrets.AIO_FASTLY_TOKEN }} + fastly-url: "${{ secrets.AIO_FASTLY_PROD_URL }}${{ needs.set-state.outputs.path_prefix }}"