-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ASAP-341 Team leadership and membership in Algolia (#4204)
* ASAP-341 Team leadership and membership in Algolia
- Loading branch information
Showing
37 changed files
with
740 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: 'Import metric' | ||
description: 'Export analytics data from Contentful and into Algolia index' | ||
inputs: | ||
algolia-api-key: | ||
description: 'Algolia api key name' | ||
required: true | ||
algolia-app-id: | ||
description: 'Algolia app id name' | ||
required: true | ||
algolia-index: | ||
description: 'Algolia index name' | ||
required: true | ||
contentful-space-id: | ||
description: 'Contentful Space ID' | ||
required: true | ||
contentful-env: | ||
description: 'Contentful environment' | ||
required: true | ||
contentful-access-token: | ||
description: 'Contentful access token' | ||
required: true | ||
contentful-management-token: | ||
description: 'Contentful management token' | ||
required: true | ||
metric: | ||
description: 'Metric' | ||
required: true | ||
outputs: | ||
algolia-app-id: | ||
description: 'Algolia App ID' | ||
value: '${{ steps.keys.outputs.algolia-app-id }}' | ||
algolia-api-key: | ||
description: 'Algolia API Key' | ||
value: '${{ steps.keys.outputs.algolia-api-key }}' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Import Metric | ||
shell: bash | ||
run: | | ||
yarn export:analytics $METRIC -f $METRIC.json | ||
jq -c '.[]' $METRIC.json | algolia objects import $ALGOLIA_INDEX -F - | ||
env: | ||
ALGOLIA_APPLICATION_ID: ${{ inputs.algolia-app-id }} | ||
ALGOLIA_ADMIN_API_KEY: ${{ inputs.algolia-api-key }} | ||
ALGOLIA_INDEX: ${{ inputs.algolia-index }} | ||
CONTENTFUL_ACCESS_TOKEN: ${{ inputs.contentful-access-token }} | ||
CONTENTFUL_ENV_ID: ${{ inputs.contentful-env }} | ||
CONTENTFUL_MANAGEMENT_ACCESS_TOKEN: ${{ inputs.contentful-management-token }} | ||
CONTENTFUL_SPACE_ID: ${{ inputs.contentful-space-id }} | ||
METRIC: ${{ inputs.metric }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
.github/workflows/on-demand-crn-analytics-algolia-sync.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: CRN Analytics Algolia Sync | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
metric: | ||
required: false | ||
type: choice | ||
description: Choose which metric to sync | ||
default: all | ||
options: | ||
- team-leadership | ||
- all | ||
environment-name: | ||
required: true | ||
type: environment | ||
description: Choose which environment to sync | ||
default: Branch | ||
contentful-environment-id: | ||
required: true | ||
type: string | ||
description: The contentful environment to sync from | ||
default: Development | ||
dedicated-contentful-environment: | ||
required: false | ||
type: boolean | ||
default: false | ||
pr-number: | ||
required: false | ||
type: string | ||
description: The PR number to run for | ||
|
||
jobs: | ||
algolia: | ||
uses: ./.github/workflows/reusable-crn-analytics-algolia-sync.yml | ||
with: | ||
environment-name: ${{ github.event.inputs.environment-name }} | ||
metric: ${{ github.event.inputs.metric }} | ||
pr-number: ${{ github.event.inputs.pr-number }} | ||
dedicated-contentful-environment: ${{ inputs.dedicated-contentful-environment }} | ||
contentful-environment-id: ${{ github.event.inputs.contentful-environment-id }} | ||
secrets: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
CRN_CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CRN_CONTENTFUL_ACCESS_TOKEN }} | ||
CONTENTFUL_MANAGEMENT_TOKEN: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }} | ||
|
||
notify_failure: | ||
runs-on: ubuntu-latest | ||
needs: [algolia] | ||
if: ${{ failure() && github.event.inputs.environment-name=='Production' }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: ./.github/actions/slack/ | ||
with: | ||
message: Analytics Algolia Prod Sync | ||
webhook: ${{ env.SLACK_WEBHOOK }} | ||
status: failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
.github/workflows/on-schedule-analytics-algolia-sync-dev.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: DEV - Sync CRN Analytics Algolia | ||
on: | ||
schedule: | ||
- cron: '0 6 * * *' # At 06:00 UTC, everyday. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/yldio/asap-hub/node-python-sq:86a189edc900d4e1afdcf3935c697292f69d409b | ||
credentials: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
environment: Development | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
id: setup | ||
uses: ./.github/actions/setup-environment | ||
with: | ||
environment-name: Development | ||
|
||
sync-crn-analytics-algolia: | ||
uses: ./.github/workflows/reusable-crn-analytics-algolia-sync.yml | ||
with: | ||
contentful-environment-id: Development | ||
environment-name: Development | ||
metric: all | ||
secrets: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
CRN_CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CRN_CONTENTFUL_ACCESS_TOKEN }} | ||
CONTENTFUL_MANAGEMENT_TOKEN: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }} |
35 changes: 35 additions & 0 deletions
35
.github/workflows/on-schedule-analytics-algolia-sync-prod.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: PROD - Sync Analytics Algolia | ||
on: | ||
schedule: | ||
- cron: '0 6 * * *' # At 06:00 UTC, everyday. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/yldio/asap-hub/node-python-sq:86a189edc900d4e1afdcf3935c697292f69d409b | ||
credentials: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
environment: Production | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
id: setup | ||
uses: ./.github/actions/setup-environment | ||
with: | ||
environment-name: Production | ||
|
||
sync-crn-analytics-algolia: | ||
uses: ./.github/workflows/reusable-crn-analytics-algolia-sync.yml | ||
with: | ||
contentful-environment-id: Production | ||
environment-name: Production | ||
metric: all | ||
secrets: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
CRN_CONTENTFUL_ACCESS_TOKEN: ${{ secrets.CRN_CONTENTFUL_ACCESS_TOKEN }} | ||
CONTENTFUL_MANAGEMENT_TOKEN: ${{ secrets.CONTENTFUL_MANAGEMENT_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.