Version 4.13.1 #115
Workflow file for this run
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: Build and Deploy to Netlify CI/CD | |
on: | |
push: | |
tags: | |
- 'dev@[0-9]+.[0-9]+.[0-9]+' | |
- 'prod@[0-9]+.[0-9]+.[0-9]+' | |
- 'canary@[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
environment: | |
name: Production | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Set Prod Environment Variables 🚀 | |
if: ${{ github.event.base_ref == 'refs/heads/master' || github.event.base_ref == 'refs/heads/canary' }} | |
run: | | |
echo "Setting prod branch secrets..." | |
echo "REACT_APP_SENTRY_DSN=${{ secrets.PROD_REACT_APP_SENTRY_DSN }}" >> $GITHUB_ENV | |
echo "REACT_APP_TINY_MCE_KEY=${{ secrets.REACT_APP_TINY_MCE_KEY }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_API_KEY=${{ secrets.PROD_REACT_APP_FIREBASE_API_KEY }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_DATABASE_URL=${{ secrets.PROD_REACT_APP_FIREBASE_DATABASE_URL }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_STORAGE_BUCKET=${{ secrets.PROD_REACT_APP_FIREBASE_STORAGE_BUCKET }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.PROD_REACT_APP_FIREBASE_MESSAGING_SENDER_ID }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_APP_ID=${{ secrets.PROD_REACT_APP_FIREBASE_APP_ID }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_MEASUREMENT_ID=${{ secrets.PROD_REACT_APP_FIREBASE_MEASUREMENT_ID }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_PROJECT_ID=${{ secrets.PROD_REACT_APP_FIREBASE_PROJECT_ID }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_AUTH_DOMAIN=${{ secrets.PROD_REACT_APP_FIREBASE_AUTH_DOMAIN }}" >> $GITHUB_ENV | |
- name: Set Dev Environment Variables 🚀 | |
if: ${{github.event.base_ref == 'refs/heads/development' }} | |
run: | | |
echo "Setting Development branch secrets..." | |
echo "Using repository secrets for $BRANCH branch..." | |
echo "REACT_APP_SENTRY_DSN=${{ secrets.REACT_APP_SENTRY_DSN }}" >> $GITHUB_ENV | |
echo "REACT_APP_TINY_MCE_KEY=${{ secrets.REACT_APP_TINY_MCE_KEY }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_API_KEY=${{ secrets.REACT_APP_FIREBASE_API_KEY }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_DATABASE_URL=${{ secrets.REACT_APP_FIREBASE_DATABASE_URL }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.REACT_APP_FIREBASE_MESSAGING_SENDER_ID }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_APP_ID=${{ secrets.REACT_APP_FIREBASE_APP_ID }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_PROJECT_ID=${{ secrets.REACT_APP_FIREBASE_PROJECT_ID }}" >> $GITHUB_ENV | |
echo "REACT_APP_FIREBASE_AUTH_DOMAIN=${{ secrets.REACT_APP_FIREBASE_AUTH_DOMAIN }}" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
npm i --legacy-peer-deps | |
- name: Build App 🏗 | |
run: | | |
make build | |
- name: Deploying to Prod 🚀 | |
if: startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'prod') && github.event.base_ref == 'refs/heads/master' | |
uses: data-intuitive/netlify-deploy-site@v1 | |
with: | |
auth: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
dir: 'build' | |
site: ${{ secrets.NETLIFY_PROD_SITE_ID }} | |
prod: true | |
message: 'Deploying ${{ github.ref }}' | |
- name: Deploying to Canary 🚀 | |
if: startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'canary') && github.event.base_ref == 'refs/heads/canary' | |
uses: data-intuitive/netlify-deploy-site@v1 | |
with: | |
auth: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
dir: 'build' | |
site: ${{ secrets.NETLIFY_CANARY_SITE_ID }} | |
prod: true | |
message: 'Deploying ${{ github.ref }}' | |
- name: Deploying to Dev 🚀 | |
if: startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'dev') && github.event.base_ref == 'refs/heads/development' | |
uses: data-intuitive/netlify-deploy-site@v1 | |
with: | |
auth: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
dir: 'build' | |
site: ${{ secrets.NETLIFY_DEV_SITE_ID }} | |
prod: true | |
message: 'Deploying ${{ github.ref }}' | |
- name: Report status to Slack 📢 | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
run: | | |
MESSAGE="Workflow *${{ github.ref}}* has completed with status: *${{ job.status }}*" | |
PAYLOAD="{\"text\": \"$MESSAGE\"}" | |
curl -X POST -H 'Content-type: application/json' --data "$PAYLOAD" $SLACK_WEBHOOK_URL | |