-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (64 loc) · 1.92 KB
/
staging.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
# Name of workflow
name: Staging workflow
# When workflow is triggered
on:
push:
branches:
- master
workflow_dispatch:
# Jobs to carry out
jobs:
build:
# Operating system to run job on
runs-on: ubuntu-latest
# Environment to run job on
environment: staging
# Environment variables
env:
DRUPAL_CONCURRENT_FILE_REQUESTS: 20
DRUPAL_REQUEST_TIMEOUT: 6000000
DRUPAL_URL: ${{ vars.DRUPAL_URL }}
# Steps in job
steps:
# Get code from repo
- name: Checkout code
uses: actions/checkout@v4
# Install NodeJS
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
# Enabling cache
- name: Caching Gatsby
id: gatsby-cache-build
uses: actions/cache@v4
with:
path: |
public
.cache
key: ${{ runner.os }}-gatsby-build-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-gatsby-build-
# Run npm install and build on our code
- run: npm install
- run: npm run build
# Deploy to Netlify using our production secrets
- name: Deploy to netlify
run: npx netlify-cli deploy --dir=public --prod
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ vars.NETLIFY_SITE_ID }}
- name: Output summary
run: echo "https://staging.lib.umich.edu" >> $GITHUB_STEP_SUMMARY
# Notify Slack if build fails
- name: Send custom JSON data to Slack workflow
if: ${{ failure() }}
uses: slackapi/[email protected]
with:
payload: |
{
"url": "https://github.com/mlibrary/lib.umich.edu/actions/runs/${{ github.run_id }}",
"message": "Staging build and deploy failed"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}