Skip to content

Commit

Permalink
chore: use latest theme && enable indexing on deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrymatio committed Jul 18, 2024
1 parent a1d5ba2 commit aa9a501
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 46 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/algolia-indexing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
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
71 changes: 31 additions & 40 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ on:
required: true
default: 'stage'
clean:
description: 'Clean cache (yes|no)'
description: "Clean cache (yes|no)"
required: true
default: 'no'
default: "no"
excludeSubfolder:
description: 'Exclude a subfolder from deletion'
description: "Exclude a subfolder from deletion"
required: false
default: 'previous-versions'
default: "previous-versions"
index-mode:
description: 'Type of indexing. "index" to push to Algolia, "console" for dry run.'
required: true
default: "index"
type: choice
options:
- console
- index
jobs:
set-state:
runs-on: ubuntu-latest
Expand All @@ -39,7 +47,7 @@ jobs:
result-encoding: string
- name: Get branch name
shell: bash
run: echo "##[set-output name=branch;]${GITHUB_REF#refs/heads/}"
run: echo "branch=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT"
id: get_branch

echo-state:
Expand All @@ -55,7 +63,7 @@ jobs:
- run: echo "Path prefix - ${{ needs.set-state.outputs.path_prefix }}"
- run: echo "Exclude subfolder - ${{ needs.set-state.outputs.exclude_subfolder }}"

pre-build-stage:
pre-build-dev:
needs: [set-state]
runs-on: ubuntu-latest
if: needs.set-state.outputs.deploy_stage == 'true'
Expand All @@ -68,7 +76,7 @@ jobs:
env:
AIO_AZURE_DEV_CONNECTION_STRING: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }}

build-stage:
build-dev:
defaults:
run:
shell: bash
Expand All @@ -81,7 +89,7 @@ jobs:
- name: Setup Node v16 for Yarn v3
uses: actions/setup-node@v3
with:
node-version: '16.15.0' # Current LTS version
node-version: "16.15.0" # Current LTS version

- name: Enable Corepack for Yarn v3
run: corepack enable
Expand Down Expand Up @@ -123,7 +131,7 @@ jobs:
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'
GATSBY_ADOBE_ANALYTICS_ENV: "dev"
REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: ${{ github.event.repository.owner.login }}
REPO_NAME: ${{ github.event.repository.name }}
Expand All @@ -142,24 +150,22 @@ jobs:
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'
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'
remove-existing-files: "true"
exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }}
- name: Delay purge
run: sleep 60s
shell: bash
- 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 }}'
fastly-url: "${{ secrets.AIO_FASTLY_DEV_URL}}${{ needs.set-state.outputs.path_prefix }}"

pre-build-production:
needs: [set-state]
Expand Down Expand Up @@ -187,7 +193,7 @@ jobs:
- name: Setup Node v16 for Yarn v3
uses: actions/setup-node@v3
with:
node-version: '16.15.0' # Current LTS version
node-version: "16.15.0" # Current LTS version

- name: Enable Corepack for Yarn v3
run: corepack enable
Expand Down Expand Up @@ -229,7 +235,7 @@ jobs:
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'
GATSBY_ADOBE_ANALYTICS_ENV: "production"
REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_OWNER: ${{ github.event.repository.owner.login }}
REPO_NAME: ${{ github.event.repository.name }}
Expand All @@ -245,39 +251,24 @@ jobs:
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: ${{ secrets.AIO_ALGOLIA_INDEXATION_MODE }}
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME || github.event.repository.name }}
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'
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'
remove-existing-files: "true"
exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }}
- name: Delay purge
run: sleep 60s
shell: bash
- 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 }}'
- name: Get current date for release tag
id: date
run: echo "TAG_DATE=$(TZ="America/Los_Angeles" date +'%Y-%m-%d')" >> "$GITHUB_ENV"
- name: Create GitHub release tag
id: create_release
uses: release-drafter/release-drafter@v5
with:
name: ${{ env.TAG_DATE }} - Deployment ${{ github.run_id }}
tag: ${{ env.TAG_DATE }}-${{ github.run_id }}
version: ${{ github.run_id }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fastly-url: "${{ secrets.AIO_FASTLY_PROD_URL }}${{ needs.set-state.outputs.path_prefix }}"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"url": "https://github.com/icaraps"
},
"dependencies": {
"@adobe/gatsby-theme-aio": "^4.14.3",
"@adobe/gatsby-theme-aio": "^4.14.4",
"gatsby": "4.22.0",
"react": "^18.2.0",
"react-dom": "^17.0.2"
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ __metadata:
languageName: node
linkType: hard

"@adobe/gatsby-theme-aio@npm:^4.14.3":
version: 4.14.3
resolution: "@adobe/gatsby-theme-aio@npm:4.14.3"
"@adobe/gatsby-theme-aio@npm:^4.14.4":
version: 4.14.4
resolution: "@adobe/gatsby-theme-aio@npm:4.14.4"
dependencies:
"@adobe/focus-ring-polyfill": ^0.1.5
"@adobe/gatsby-source-github-file-contributors": ^0.3.1
Expand Down Expand Up @@ -132,7 +132,7 @@ __metadata:
gatsby: ^4.22.0
react: ^17.0.2
react-dom: ^17.0.2
checksum: 4d638dc2bf5824ed35bbe1daa1ed001509930b95ae368fb8049e5de749496ab3d01e1dd8e8dc29f300db9dfcba0105afe003ac2f2f7ca7bad984d78a9e96999c
checksum: 846ee1128ccfee37bb36313ee594349369bba472f93ca7f6b6142b7ede79842f808f3458659abbbe7972171166a14674aa1860b8ca7539c1300a804f3794b54d
languageName: node
linkType: hard

Expand Down Expand Up @@ -11373,7 +11373,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "dev-site-documentation-template@workspace:."
dependencies:
"@adobe/gatsby-theme-aio": ^4.14.3
"@adobe/gatsby-theme-aio": ^4.14.4
gatsby: 4.22.0
lodash.template: ^4.5.0
octokit: ^3.2.0
Expand Down

0 comments on commit aa9a501

Please sign in to comment.