Skip to content

Dev workflow

Dev workflow #58

Workflow file for this run

# Name of workflow
name: Dev workflow
# When workflow is triggered
on:
workflow_dispatch:
# Jobs to carry out
jobs:
build:
# Operating system to run job on
runs-on: ubuntu-latest
# Environment to run job on
environment: development
# 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
- name: get short sha
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_ENV
echo "DEPLOY_URL=https://deploy-preview-$SHORT_SHA--future-wwwlib-development.netlify.app" >> $GITHUB_ENV
# 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 staging secrets
- name: Deploy to netlify
run: npx netlify-cli deploy --dir=public --alias deploy-preview-${{ env.SHORT_SHA }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ vars.NETLIFY_SITE_ID }}
- name: Output summary
run: echo $DEPLOY_URL >> $GITHUB_STEP_SUMMARY
# Notify Slack if build fails
- name: Send custom JSON data to Slack workflow
if: ${{ failure() }}
uses: slackapi/slack-github-action@v1.25.0
with:
payload: |
{
"url": "https://github.com/mlibrary/lib.umich.edu/actions/runs/${{ github.run_id }}",
"message": "Development build and deploy failed"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}