Build and Deploy #107
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 | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * *' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'latest' | |
- name: Install Dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Commit and push changes to repository | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: 'Automated build/blog feed update' | |
- name: Set the domain | |
id: set-domain | |
run: | | |
echo "DOMAIN=$(node -e 'console.log(new URL(require("./src/customizations/siteproperties.json").url).hostname)')" >> $GITHUB_OUTPUT | |
- name: Add CNAME to dist | |
run: | | |
if [[ "${{ steps.set-domain.outputs.DOMAIN }}" != *.github.io ]]; then | |
echo ${{ steps.set-domain.outputs.DOMAIN }} > ./dist/CNAME | |
fi | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: dist | |
branch: gh-pages |