Merge pull request #318 from mlibrary/WEBSITE-134-adjust-colors-for-i… #781
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 of workflow | |
name: Backup workflow | |
# When workflow is triggered | |
on: | |
push: | |
branches: | |
- master | |
# schedule: | |
# - cron: '0 11 * * MON-FRI' | |
repository_dispatch: | |
types: [ publish_production ] | |
workflow_dispatch: | |
# Jobs to carry out | |
jobs: | |
build: | |
# Operating system to run job on | |
runs-on: ubuntu-latest | |
# Environment to run job on | |
environment: backup | |
# Environment variables | |
env: | |
DRUPAL_CONCURRENT_FILE_REQUESTS: 20 | |
DRUPAL_REQUEST_TIMEOUT: 6000000 | |
DRUPAL_URL: ${{ vars.DRUPAL_URL }} | |
ROBOTSTXT_MODE: 'production' | |
CONTEXT: 'production' | |
# 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 s3 | |
- name: Set s3 bucket credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-2 | |
- name: Copy files to s3 | |
run: aws s3 sync ./public s3://lib-umich-backup | |
# 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": "Backup failed" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }} |