Bump semver from 5.7.1 to 5.7.2 in /blog #2423
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: "Blog: CI/CD" | |
run-name: ${{ github.event.client_payload.text }} | |
on: | |
repository_dispatch: | |
types: [publish_blog] | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: | |
- 'blog/**' | |
- 'shared/**' | |
pull_request: | |
branches: [main] | |
paths: | |
- 'blog/**' | |
- 'shared/**' | |
jobs: | |
blog: | |
name: Build Blog | |
runs-on: ubuntu-latest | |
env: | |
PRODUCTION_DOMAIN: blog.deepgram.com | |
STAGING_DOMAIN: sweet-pie-c52a63-blog.netlify.app | |
BUILD_PATH: ./blog | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_BLOG }} | |
IS_PRODUCTION: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} | |
IS_STAGING: ${{ github.ref != 'refs/heads/main' && github.event_name == 'pull_request' }} | |
DEPLOY_PREFIX: blog | |
steps: | |
- name: Configure dynamic environment variables for production | |
if: ${{ env.IS_PRODUCTION == 'true' }} | |
run: | | |
echo "URL=https://${{ env.PRODUCTION_DOMAIN }}" >> $GITHUB_ENV | |
echo "BUILD_ALIAS=" >> $GITHUB_ENV | |
echo "DEPLOY_MESSAGE=$(echo '${{ github.event.head_commit.message }}' | head -1)" >> $GITHUB_ENV | |
echo "ENVIRONMENT_NAME=${{ env.DEPLOY_PREFIX }}-production" >> $GITHUB_ENV | |
echo "ENVIRONMENT_DESC=Production deployment for ${{ env.DEPLOY_PREFIX }} site. Last deployment: $(echo '${{ github.event.head_commit.message }}' | head -1)" >> $GITHUB_ENV | |
- name: Configure dynamic environment variables for staging | |
if: ${{ env.IS_STAGING == 'true' }} | |
run: | | |
echo "URL=https://deploy-preview-${{ github.event.number }}--${{ env.STAGING_DOMAIN }}" >> $GITHUB_ENV | |
echo "BUILD_ALIAS=deploy-preview-${{ github.event.number }}" >> $GITHUB_ENV | |
echo "DEPLOY_MESSAGE=${{ github.event.pull_request.title }}" >> $GITHUB_ENV | |
echo "ENVIRONMENT_NAME=${{ env.DEPLOY_PREFIX }}-deploy-preview-${{ github.event.number }}" >> $GITHUB_ENV | |
echo "ENVIRONMENT_DESC=Deploy preview for ${{ env.DEPLOY_PREFIX }} site. Pull request: #${{ github.event.number }}" >> $GITHUB_ENV | |
- name: Configure dynamic environment variables for manual runs | |
if: ${{ env.IS_STAGING != 'true' && env.IS_PRODUCTION != 'true' }} | |
run: | | |
echo "URL=https://${{ env.PRODUCTION_DOMAIN }}" >> $GITHUB_ENV | |
echo "BUILD_ALIAS=${{ github.head_ref }}" >> $GITHUB_ENV | |
echo "DEPLOY_MESSAGE=Deployment from GitHub Action" >> $GITHUB_ENV | |
echo "ENVIRONMENT_NAME=manual-deploy-${{ github.head_ref || github.run_id }}" >> $GITHUB_ENV | |
echo "ENVIRONMENT_DESC=Deploy preview for ${{ env.DEPLOY_PREFIX }} site" >> $GITHUB_ENV | |
- name: Generate site URLs | |
run: | | |
echo "WWW_DOMAIN=https://deepgram.com" >> $GITHUB_ENV | |
echo "BLOG_DOMAIN=${{ env.URL }}" >> $GITHUB_ENV | |
echo "DOCS_DOMAIN=https://developers.deepgram.com" >> $GITHUB_ENV | |
echo "CONSOLE_DOMAIN=https://console.deepgram.com" >> $GITHUB_ENV | |
echo "STATUS_DOMAIN=https://status.deepgram.com" >> $GITHUB_ENV | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: ${{ env.BUILD_PATH }}/.nvmrc | |
- name: Install dependencies | |
run: | | |
cd ${{ env.BUILD_PATH }} | |
yarn install | |
- name: Copy Netlify functions from shared | |
run: | | |
cd ${{ env.BUILD_PATH }} | |
yarn functions:clean && yarn functions:copy | |
- name: Build ${{ env.DEPLOY_PREFIX }} site | |
run: | | |
cd ${{ env.BUILD_PATH }} | |
./node_modules/.bin/ntl build | |
- name: Deploy ${{ env.DEPLOY_PREFIX }} site to Netlify | |
uses: nwtgck/[email protected] | |
with: | |
publish-dir: ${{ env.BUILD_PATH }}/dist | |
production-branch: main | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: ${{ env.DEPLOY_MESSAGE }} | |
enable-pull-request-comment: false # default: true | |
enable-commit-comment: true # default: true | |
overwrites-pull-request-comment: false # default: true | |
production-deploy: ${{ env.IS_PRODUCTION }} | |
functions-dir: ${{ env.BUILD_PATH }}/functions | |
alias: ${{ env.BUILD_ALIAS }} | |
github-deployment-environment: ${{ env.ENVIRONMENT_NAME }} | |
github-deployment-description: ${{ env.ENVIRONMENT_DESC }} | |
timeout-minutes: 5 |