-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from digitalpolygon/automatic-documentation-syn…
…chronization Automatic documentation synchronization.
- Loading branch information
Showing
2 changed files
with
110 additions
and
0 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,48 @@ | ||
#!/bin/bash | ||
|
||
# ### | ||
# Deploys Drupal-Docs project Pantheon multidev and dev environments. | ||
# ### | ||
|
||
# Exit if anything fails | ||
set -eo pipefail | ||
|
||
# Cut gitignore at the cut mark. | ||
terminus build:gitignore:cut | ||
|
||
# Authenticate with Terminus | ||
terminus -n auth:login --machine-token="$TERMINUS_TOKEN" | ||
|
||
# Environment from which multidevs will be created. | ||
CREATE_MDS_FROM="dev" | ||
TERMINUS_ENV="dev" | ||
|
||
if [[ "$CI_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then | ||
# Use develop as the environment. | ||
TERMINUS_ENV="develop" | ||
fi | ||
|
||
if [[ "$BASE_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then | ||
# Use develop as the environment. | ||
CREATE_MDS_FROM="develop" | ||
fi | ||
|
||
# If its a PR to development or production branch, create a multidev. | ||
if [[ -n "$PR_NUMBER" ]] ; then | ||
TERMINUS_ENV="pr-${PR_NUMBER}" | ||
fi | ||
|
||
echo "Preparing $TERMINUS_ENV multidev from $CREATE_MDS_FROM for $TERMINUS_SITE" | ||
|
||
set +e | ||
TERMINUS_ENV_EXISTS=$(terminus env:list "$TERMINUS_SITE" --field=ID | grep -w $TERMINUS_ENV) | ||
set -e | ||
|
||
if [[ -z "$TERMINUS_ENV_EXISTS" ]] | ||
then | ||
echo "Site $TERMINUS_SITE does not have a $TERMINUS_ENV multidev..." | ||
else | ||
echo "Syncing documentation $TERMINUS_ENV on $TERMINUS_SITE" | ||
# Run The migration deploy. | ||
terminus drush "$TERMINUS_SITE.$TERMINUS_ENV" -- migrate:import schemaorg_metata -y; | ||
fi |
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,62 @@ | ||
name: Build and Deploy to Pantheon | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }} | ||
CI_BRANCH: ${{ github.head_ref || github.ref_name }} | ||
BASE_BRANCH: ${{ github.base_ref }} | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_OWNER: ${{ github.repository_owner }} | ||
PRODUCTION_BRANCH: 'main' | ||
DEVELOPMENT_BRANCH: 'develop' | ||
PR_NUMBER: ${{ github.event.number }} | ||
TERMINUS_SITE: 'drupaldocs' | ||
|
||
jobs: | ||
deploy_to_pantheon: | ||
name: Deploy to pantheon | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set ownership | ||
run: | | ||
chown -R $(id -u):$(id -g) $PWD | ||
- name: Setup PHP | ||
id: setup-php | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
|
||
- name: Install Terminus | ||
uses: pantheon-systems/terminus-github-actions@main | ||
with: | ||
pantheon-machine-token: ${{ secrets.TERMINUS_TOKEN }} | ||
|
||
- name: Install Terminus Build Tools | ||
run: | | ||
terminus self:plugin:install terminus-build-tools-plugin | ||
- name: Checkout source branch | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref || github.ref_name }} | ||
fetch-depth: 0 | ||
|
||
# Deploy to Pantheon Downstream sites | ||
- name: Deploy to Pantheon | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
.github/dev-multidev.sh |