Skip to content

Commit 7d6c22d

Browse files
Create deploy-to-pantheon.yml (#5556)
Co-authored-by: Kim (Sumo Logic) <[email protected]>
1 parent dfb5858 commit 7d6c22d

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: deploy-to-pantheon
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-and-deploy-to-pantheon:
13+
runs-on: ubuntu-latest
14+
environment:
15+
name: production
16+
url: https://www.sumologic.com/
17+
env:
18+
CI: true
19+
NODE_ENV: production
20+
NODE_OPTIONS: "--max-old-space-size=8192 --max-http-header-size=8192"
21+
HOSTNAME: https://www.sumologic.com
22+
BASE_URL: /help/
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- name: Install SSH key
28+
uses: shimataro/ssh-key-action@v2
29+
with:
30+
key: ${{ secrets.PANTHEON_SSH_KEY }}
31+
config: |
32+
Host *.drush.in
33+
StrictHostKeyChecking no
34+
known_hosts: ${{ secrets.PANTHEON_KNOWN_HOSTS }}
35+
- name: Setup PHP
36+
uses: shivammathur/setup-php@v2
37+
with:
38+
php-version: "8.2"
39+
- name: Install Terminus
40+
uses: pantheon-systems/terminus-github-actions@v1
41+
with:
42+
pantheon-machine-token: ${{ secrets.PANTHEON_MACHINE_TOKEN }}
43+
- name: Set up Node.js
44+
uses: actions/setup-node@v3
45+
with:
46+
node-version: '20.x'
47+
cache: 'yarn'
48+
- name: Docusaurus Webpack cache
49+
uses: actions/cache@v3
50+
with:
51+
path: node_modules/.cache
52+
key: ${{ runner.os }}-webpack-cache-${{ hashFiles('yarn.lock') }}
53+
- name: Install dependencies
54+
run: yarn install --frozen-lockfile
55+
- name: Build the Docusaurus site
56+
run: yarn build
57+
- name: Pantheon, check environment and deploy helpdocs
58+
run: |
59+
# Check for helpdocs environment in Pantheon, create one if not found
60+
PANTHEON_ENV_LIST="$(terminus env:list "${{ vars.PANTHEON_SITE_ID }}" --format=list | xargs)"
61+
DEV_SITE_EXISTS="$(echo "$PANTHEON_ENV_LIST" | grep "helpdocs" | wc -l | xargs)"
62+
if [ "$DEV_SITE_EXISTS" -eq "0" ]; then
63+
terminus multidev:create --no-interaction --no-ansi ${{ vars.PANTHEON_SITE_ID }}.dev helpdocs
64+
terminus lock:enable ${{ vars.PANTHEON_SITE_ID }}.helpdocs -- "${{ secrets.PANTHEON_AUTH_USER }}" "${{ secrets.PANTHEON_AUTH_PASSWORD }}"
65+
fi
66+
# Put environment in SFTP mode, because we're using rsync to move files up
67+
terminus connection:set ${{ vars.PANTHEON_SITE_ID }}.helpdocs sftp
68+
terminus self:plugin:install terminus-rsync-plugin
69+
mv ./build ./help
70+
terminus rsync ./help ${{ vars.PANTHEON_SITE_ID }}.helpdocs:code
71+
terminus env:commit --message "Production build of helpdocs" --force -- ${{ vars.PANTHEON_SITE_ID }}.helpdocs

0 commit comments

Comments
 (0)