-
Notifications
You must be signed in to change notification settings - Fork 2
98 lines (82 loc) · 3.09 KB
/
pantheon-deploy-dev-manual.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Pantheon Deploy Dev Manually
on:
workflow_dispatch:
inputs:
BRANCH:
description: 'Branch to use'
required: true
default: 'main'
type: choice
options:
- main
env:
GIT_COMMIT_MESSAGE: 'Github Actions Build'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Clone the github repo in the Github Action container
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.BRANCH }}
- name: Set some variables to use in the workflow
run: |
echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
echo "GRUMPHP_GIT_WORKING_DIR=$(git rev-parse --show-toplevel)" >> $GITHUB_ENV
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ vars.PHP_VERSION }}
- name: Add the Pantheon SSH Key for the CI user
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.PANTHEON_SSH_PRIVATE_KEY }}
- name: Disable Pantheon SSH strict host key checking
run: 'printf "\nHost *\n\tStrictHostKeyChecking no" >> ~/.ssh/config'
- name: Configure git config
run: |
git config --global user.name "NY Senate CI Bot"
git config --global user.email "[email protected]"
- name: Set up the Pantheon GIT Remote
run: |
git remote add pantheon ${{ vars.PANTHEON_GIT_REMOTE }}
echo $(git remote -v)
- name: Cache Composer dependencies to make builds faster
uses: actions/cache@v3
env:
cache-name: cache-vendor
with:
path: ./vendor
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
- name: Make composer available and do a composer install to build Drupal
uses: php-actions/composer@v6
with:
php_version: ${{ vars.PHP_VERSION }}
php_extensions: gd sodium zip
- name: Setup Node with the version set in .nvmrc
uses: actions/setup-node@v3
with:
node-version-file: '${{ vars.THEME_PATH }}/.nvmrc'
cache: 'npm'
cache-dependency-path: '${{ vars.THEME_PATH }}/package-lock.json'
- name: Build Theme Assets
run: |
cd ${{ vars.THEME_PATH }}
npm install
npm run build
- name: Deploy to Pantheon Dev (master)
run: |
rm -rf ${{ vars.THEME_PATH }}/node_modules
git add -Af .
git commit -q -m "${{ env.GIT_COMMIT_MESSAGE }} - ${{ env.NOW }}"
git push --force pantheon HEAD:refs/heads/master
- name: Post to a Slack channel
if: always()
id: slack
uses: slackapi/[email protected]
with:
channel-id: '${{ vars.SLACK_CHANNEL }}'
slack-message: "@${{ github.actor }} deployed a new release and it was a ${{ job.status }}!\nUsing Workflow: ${{ github.workflow }}\nPantheon: https://dev-${{ vars.PANTHEON_SITE }}.pantheonsite.io"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}