Merge pull request #52 from interchainio/simapp-fix #63
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) | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
pull-requests: write | |
env: | |
BRANCH_NAME: ${{ github.ref_name }} | |
jobs: | |
deploy: | |
name: 'Deploy to Netlify' | |
runs-on: ubuntu-latest | |
steps: | |
- 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/[email protected] | |
with: | |
node-version: 20 | |
cache: "npm" | |
- name: Install Netlify | |
run: npm install [email protected] -g | |
- name: Install Dependencies | |
run: npm ci | |
# - name: Clear old docs references | |
# run: make fresh | |
- 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 "DEPLOY_TO_PROD=false" >> $GITHUB_ENV | |
else | |
echo "Deploying to prod environment, no deploy alias" | |
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" |