Production workflow #112
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: Production workflow | |
# When workflow is triggered | |
on: | |
push: | |
branches: | |
- main | |
# schedule: | |
# - cron: '0 11 * * MON-FRI' | |
repository_dispatch: | |
workflow_dispatch: | |
jobs: | |
build-production: | |
runs-on: ubuntu-latest | |
environment: production | |
env: | |
DRUPAL_AUTH: ${{ secrets.DRUPAL_AUTH }} | |
DRUPAL_URL: ${{ vars.DRUPAL_URL }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.x | |
- run: npm install | |
#- name: Caching 11ty | |
#id: eleventy-cache-build | |
#uses: actions/cache@v2 | |
#with: | |
#path: | | |
#public | |
#.cache | |
#key: ${{ runner.os }}-eleventy-build-${{ github.run_id }} | |
#restore-keys: | | |
#${{ runner.os }}-eleventy-build- | |
- run: npm run build | |
- 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: Send custom JSON data to Slack workflow | |
if: ${{ failure() }} | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"url": "https://github.com/mlibrary/design-system-docs/actions/runs/${{ github.run_id }}", | |
"message": "Production build and deploy failed" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ vars.SLACK_BUILD_FAIL_URL }} |