Split Canary Sites #563
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
name: 'Split Canary Sites' | |
# run this job on after canary_release has completed | |
on: | |
workflow_run: | |
workflows: [Canary Release] | |
types: | |
- completed | |
# split the starers to repos to be deployed on the platform | |
# for easy QA testing | |
jobs: | |
# this job should only run if canary_release was successful | |
on-success: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# define package to repository map | |
include: | |
# next-drupal-starter + umami | |
- local_path: 'starters/next-drupal-starter-umami-canary-generated' | |
split_repository: 'next-drupal-starter-umami-canary' | |
generator_cmd: | |
"next-drupal next-drupal-umami-addon --appName | |
@pantheon-systems/next-drupal-starter-umami-canary --cmsEndpoint | |
'' --tailwindcss --force --silent" | |
# next-drupal-starter default | |
- local_path: 'starters/next-drupal-starter-default-canary-generated' | |
split_repository: 'next-drupal-starter-default-canary' | |
generator_cmd: | |
"next-drupal --appName | |
@pantheon-systems/next-drupal-starter-default-canary --cmsEndpoint | |
'' --tailwindcss --force --silent" | |
# gatsby-wordpress-starter | |
- local_path: 'starters/gatsby-wordpress-starter-canary-generated' | |
split_repository: 'gatsby-wordpress-starter-default-canary' | |
generator_cmd: | |
"gatsby-wp --appName | |
@pantheon-systems/gatsby-wordpress-starter-canary --cmsEndpoint '' | |
--tailwindcss --force --silent" | |
# next-wordpress-starter | |
- local_path: 'starters/next-wordpress-starter-canary-generated' | |
split_repository: 'next-wordpress-starter-default-canary' | |
generator_cmd: | |
"next-wp --appName @pantheon-systems/next-wordpress-starter-canary | |
--cmsEndpoint '' --tailwindcss --force --silent" | |
# canary docs site | |
- local_path: 'web' | |
split_repository: 'decoupled-kit-docs-canary' | |
generator_cmd: '' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup node | |
if: ${{ matrix.generator_cmd != '' }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
# install canary version of the CLI | |
# run the command to generate the starter in the matrix.local_path directory | |
- name: Generate starter | |
if: ${{ matrix.generator_cmd != '' }} | |
run: | | |
npm i --global create-pantheon-decoupled-kit@canary | |
create-pantheon-decoupled-kit ${{ matrix.generator_cmd }} --outDir ./${{ matrix.local_path }} | |
- name: Add GitHub workflow before split | |
run: | | |
mkdir -p ${{ github.workspace }}/${{ matrix.local_path }}/.github/workflows | |
cp ${{ github.workspace }}/.github/templates/trigger-e2e.yml.template ${{ github.workspace }}/${{ matrix.local_path }}/.github/workflows/trigger-e2e.yml | |
- name: Split repos | |
uses: 'danharrin/[email protected]' | |
with: | |
# ↓ split <local_path> directory | |
package_directory: '${{ matrix.local_path }}' | |
# ↓ into https://github.com/org/split_repository repository | |
repository_organization: 'pantheon-systems' | |
repository_name: '${{ matrix.split_repository }}' | |
# ↓ the user signed under the split commit | |
user_name: 'pantheon-decoupled-service-user' | |
user_email: '[email protected]' | |
- name: Send custom JSON data to Slack workflow | |
id: slack | |
uses: slackapi/[email protected] | |
with: | |
# For posting a rich message using Block Kit | |
payload: | | |
{ | |
"text": "GitHub Action result: ${{ job.status }}\n${{ github.ref }}", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "GitHub Action result: ${{ job.status }}\n${{ github.ref }}" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |