Automatic documentation synchronization. #1
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: 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: Checkout source branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref || github.ref_name }} | |
fetch-depth: 0 | |
- name: Install Terminus Build Tools | |
run: | | |
terminus self:plugin:install terminus-build-tools-plugin | |
- name: setup-environment-vars | |
run: | | |
export CI_BRANCH=`curl -u "${GITHUB_OWNER}:${GITHUB_TOKEN}" \ | |
-H "Accept: application/vnd.github.groot-preview+json" \ | |
"https://api.github.com/repos/${CI_PROJECT_NAME}/commits/${COMMIT_SHA}/pulls" | \ | |
python3 -c "import sys, json; print(json.load(sys.stdin)[0]['head']['ref'])"` | |
- name: Avoid GitHub rate limit for Composer | |
run: | | |
composer config -g github-oauth.github.com $GITHUB_TOKEN | |
- name: Add HTTP basic auth credentials | |
run: | | |
echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json | |
- name: Build composer dependencies | |
run: | | |
composer install --no-dev --no-interaction --optimize-autoloader | |
- name: Configure Git config | |
run: | | |
git config --global user.name "Adrian Morelos" | |
git config --global user.email "adrian@digitalpolygon.com" | |
# Deploy to Pantheon Downstream sites | |
- name: Deploy to Pantheon | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "$SSH_PRIVATE_KEY" > ../private.key | |
chmod 600 ../private.key | |
eval `ssh-agent -s` | |
ssh-add ../private.key | |
git config --global --add safe.directory /__w/leaf-home-mapletree/leaf-home-mapletree | |
ssh-add -L | ssh-keygen -l -E md5 -f - | awk '{print substr($2,5)}' | |
./.github/deploy/pantheon/dev-multidev |