Skip to content

Deploy blog (optimized) #19

Deploy blog (optimized)

Deploy blog (optimized) #19

name: Deploy blog (optimized)
on:
workflow_dispatch:
pull_request:
push:
branches:
- 'captaaint/blog'
paths:
- 'blog/**'
permissions:
contents: write
pull-requests: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max-old-space-size=8192"
TURBO_UI: "false"
steps:
- name: 1. Generate a token from the GitHub App 🤖
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"
registry-url: https://registry.npmjs.org/
- name: Cache for Turbo
uses: rharkor/caching-for-turbo@v2.3.1
- run: npm ci --prefer-offline
- name: 4. Configure Git to use the App's token 🔑
# The token generated in the first step is used here for authentication.
run: git config --global url."https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/".insteadOf "https://github.com/"
- name: 5. DEBUG - Attempt to clone the private repo
# This step will give a clear error if authentication is the problem
run: git clone https://github.com/xmlui-org/xmlui-optimizer.git
- name: 5. Install optimizer's dependencies
run: npm install
working-directory: ./xmlui-optimizer
- name: DEBUG - install xmlui-optimizer
# This step will give a clear error if authentication is the problem
run: npm install ./xmlui-optimizer
- run: npm run build-blog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v3.0
with:
publish-dir: ./blog/dist
production-deploy: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.XMLUI_BLOG_NETLIFY_SITE_ID }}