site-map generation #10
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: 'Netlify Deploy' | |
# Disable `Pretty URLs` (Site Confiuration > Build & Deploy > Post Processing > Pretty URLs) | |
permissions: | |
pull-requests: write | |
on: | |
# TODO: cron | |
# release: | |
# types: [published] | |
push: | |
# branches: | |
# - main | |
env: | |
BRANCH_NAME: ${{ github.ref_name }} | |
jobs: | |
deploy: | |
name: 'Deploy to Netlify' | |
runs-on: ubuntu-latest | |
steps: | |
# ensure the secrets are set, if not, error | |
- name: Check Secrets | |
run: | | |
if [ -z "${{ secrets.NETLIFY_SITE_ID }}" ]; then | |
echo "NETLIFY_SITE_ID is not set. Please set it in the repository secrets." | |
exit 1 | |
fi | |
if [ -z "${{ secrets.NETLIFY_AUTH_TOKEN }}" ]; then | |
echo "NETLIFY_AUTH_TOKEN is not set. Please set it in the repository secrets." | |
exit 1 | |
fi | |
- name: Repository Checkout | |
uses: actions/checkout@v4 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
- name: Install Netlify | |
run: npm install [email protected] -g | |
- name: Install Dependencies | |
run: npm ci | |
- name: 🤔 Sync latest Upstream | |
run: make sync-docs | |
- name: Build website 🔨 | |
run: make build-docs | |
# if the branch is not main, then its a deploy to non prod, set DEPLOY_TO_PROD to false | |
- name: Set Deploy to Prod | |
run: | | |
if [ "${{ env.BRANCH_NAME }}" != "main" ]; then | |
echo "Deploying to non-prod environment" | |
echo "Setting DEPLOY_TO_PROD to false" | |
echo "DEPLOY_TO_PROD=false" >> $GITHUB_ENV | |
else | |
echo "Deploying to prod environment" | |
echo "Setting DEPLOY_TO_PROD to true" | |
echo "DEPLOY_TO_PROD=true" >> $GITHUB_ENV | |
fi | |
# https://app.netlify.com/user/applications#personal-access-tokens | |
# ref: https://www.raulmelo.me/en/blog/deploying-netlify-github-actions-guide | |
# ref: NETLIFY_SITE_ID is a UUID from Netlify | |
- name: Deploy to Netlify | |
uses: jsmrcaga/[email protected] | |
with: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
NETLIFY_DEPLOY_MESSAGE: "Deployed from GitHub action" | |
NETLIFY_DEPLOY_TO_PROD: ${{ env.DEPLOY_TO_PROD }} | |
install_command: "echo Skipping installing the dependencies" | |
build_command: "echo Skipping building the web files" |