|
| 1 | +name: Deploy blog (optimized) |
| 2 | + |
| 3 | +#on: |
| 4 | +# workflow_dispatch: |
| 5 | +# inputs: |
| 6 | +# max_releases: |
| 7 | +# description: "Maximum number of releases to include in blog" |
| 8 | +# type: number |
| 9 | +# required: false |
| 10 | +# default: 10 |
| 11 | +on: |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - captaaint/blog-deploy |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: write |
| 18 | + pull-requests: write |
| 19 | + |
| 20 | +jobs: |
| 21 | + build-and-deploy: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + env: |
| 24 | + NODE_OPTIONS: "--max-old-space-size=8192" |
| 25 | + TURBO_UI: "false" |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: 1. Generate a token from the GitHub App 🤖 |
| 29 | + id: generate_token |
| 30 | + uses: tibdex/github-app-token@v2 |
| 31 | + with: |
| 32 | + app_id: ${{ secrets.APP_ID }} |
| 33 | + private_key: ${{ secrets.APP_PRIVATE_KEY }} |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + - uses: actions/setup-node@v4 |
| 36 | + with: |
| 37 | + node-version: 22 |
| 38 | + cache: "npm" |
| 39 | + registry-url: https://registry.npmjs.org/ |
| 40 | + |
| 41 | + - name: Cache for Turbo |
| 42 | + uses: rharkor/caching-for-turbo@v2.3.1 |
| 43 | + |
| 44 | + - run: npm ci --prefer-offline |
| 45 | + |
| 46 | + - name: 4. Configure Git to use the App's token 🔑 |
| 47 | + # The token generated in the first step is used here for authentication. |
| 48 | + run: git config --global url."https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/".insteadOf "https://github.com/" |
| 49 | + - name: 5. DEBUG - Attempt to clone the private repo |
| 50 | + # This step will give a clear error if authentication is the problem |
| 51 | + run: git clone https://github.com/xmlui-org/xmlui-optimizer.git |
| 52 | + - name: 5. Install optimizer's dependencies |
| 53 | + run: npm install |
| 54 | + working-directory: ./xmlui-optimizer |
| 55 | + - name: DEBUG - install xmlui-optimizer |
| 56 | + # This step will give a clear error if authentication is the problem |
| 57 | + run: npm install ./xmlui-optimizer |
| 58 | + |
| 59 | + - run: cd blog && npm run build-optimized |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + DOCS_XMLUI_MAX_RELEASES_LENGTH: ${{ github.event.inputs.max_releases }} |
| 63 | + |
| 64 | + - name: Deploy to Netlify |
| 65 | + uses: nwtgck/actions-netlify@v2.0.0 |
| 66 | + with: |
| 67 | + publish-dir: ./xmlui-optimized-output |
| 68 | + production-deploy: true |
| 69 | + env: |
| 70 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }} |
| 71 | + NETLIFY_SITE_ID: ${{ secrets.XMLUI_BLOG_NETLIFY_SITE_ID }} |
0 commit comments