Deploy blog (optimized) #8
This file contains hidden or 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: Deploy blog (optimized) | |
| on: | |
| workflow_dispatch: | |
| 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 | |
| - name: Build extensions | |
| run: npm run build-extensions | |
| - run: cd blog && npm run build-optimized | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Deploy to Netlify | |
| uses: nwtgck/actions-netlify@v3.0 | |
| with: | |
| publish-dir: ./blog/xmlui-optimized-output | |
| production-deploy: true | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.XMLUI_BLOG_NETLIFY_SITE_ID }} |