Skip to content

Commit 64a5fbc

Browse files
authored
Create pantheon-deploy-to-staging.yml
1 parent 016f405 commit 64a5fbc

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: deploy-to-pantheon-prod
2+
3+
permissions:
4+
deployments: write
5+
contents: write
6+
pull-requests: read
7+
8+
on:
9+
push:
10+
branches:
11+
- staging/**
12+
paths-ignore:
13+
- .github/**
14+
15+
jobs:
16+
build-and-deploy-to-pantheon-prod:
17+
runs-on: ubuntu-latest
18+
environment:
19+
name: production
20+
url: https://www.sumologic.com/
21+
env:
22+
CI: true
23+
NODE_ENV: production
24+
NODE_OPTIONS: "--max-old-space-size=8192 --max-http-header-size=8192"
25+
HOSTNAME: https://www.sumologic.com
26+
BASE_URL: /help/
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
- name: Install SSH key
32+
uses: shimataro/ssh-key-action@v2
33+
with:
34+
key: ${{ secrets.PANTHEON_SSH_KEY }}
35+
config: |
36+
Host *.drush.in
37+
StrictHostKeyChecking no
38+
known_hosts: ${{ secrets.PANTHEON_KNOWN_HOSTS }}
39+
- name: Setup PHP
40+
uses: shivammathur/setup-php@v2
41+
with:
42+
php-version: "8.2"
43+
- name: Install Terminus
44+
run: |
45+
sudo apt update
46+
sudo apt install -y curl php-common php-cli php-xml php-mbstring php-curl git jq
47+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
48+
php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }"
49+
php composer-setup.php
50+
php -r "unlink('composer-setup.php');"
51+
mv composer.phar /usr/local/bin/composer
52+
export ASSET_ID="$(curl -sL -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' https://api.github.com/repos/vfalconisumo/sumo-terminus/releases | jq -r '.[0].assets[0].id')"
53+
curl -sL -H "Accept: application/octet-stream" -H "X-GitHub-Api-Version: 2022-11-28" -o terminus "https://api.github.com/repos/vfalconisumo/sumo-terminus/releases/assets/$ASSET_ID"
54+
chmod +x terminus
55+
mv terminus /usr/local/bin/terminus
56+
terminus self:update
57+
- name: Set up Node.js
58+
uses: actions/setup-node@v3
59+
with:
60+
node-version: '20.x'
61+
cache: 'yarn'
62+
- name: Docusaurus Webpack cache
63+
uses: actions/cache@v3
64+
with:
65+
path: node_modules/.cache
66+
key: ${{ runner.os }}-webpack-cache-${{ hashFiles('yarn.lock') }}
67+
- name: Install dependencies
68+
run: yarn install --frozen-lockfile
69+
- name: Build the Docusaurus site
70+
run: |
71+
yarn build
72+
- name: Pantheon, check environment and deploy helpdocs
73+
run: |
74+
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | xargs -L1 git config --unset-all
75+
git config --global user.email "${{ secrets.PANTHEON_USER_EMAIL }}"
76+
git config --global user.name "GitHub workflow"
77+
terminus auth:login --machine-token ${{ secrets.PANTHEON_MACHINE_TOKEN }}
78+
terminus local:clone --yes --branch="helpdocs" ${{ vars.PANTHEON_SITE_ID }}
79+
echo "deployed" > ./build/index.html
80+
rsync --archive ./build/ "$HOME/pantheon-local-copies/${{ vars.PANTHEON_SITE_ID }}/help/"
81+
terminus local:commitAndPush --yes sumo-logic-sandbox
82+
terminus auth:logout

0 commit comments

Comments
 (0)