Skip to content

Commit

Permalink
upgrades (#148)
Browse files Browse the repository at this point in the history
* enable indexing on deploy

* Create algolia-indexing.yml

* Use latest [email protected]
  • Loading branch information
dmitrymatio authored Jul 30, 2024
1 parent 65a6c99 commit 1434ce2
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 22 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
52 changes: 31 additions & 21 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@ on:
workflow_dispatch:
inputs:
env:
description: 'Deploy to (dev|prod|dev prod)'
description: "Deploy to (dev|prod|dev prod)"
required: true
default: 'dev'
default: "dev"
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: ''
default: ""
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 "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
run: echo "branch=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT"
id: get_branch

echo-state:
Expand Down Expand Up @@ -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,21 +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: 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 @@ -184,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 @@ -226,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 @@ -242,23 +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: 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 }}'
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.11.0",
"@adobe/gatsby-theme-aio": "^4.14.6",
"gatsby": "4.22.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
Expand Down

0 comments on commit 1434ce2

Please sign in to comment.