Deploy Blog #5
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" | |
| concurrency: | |
| group: deploy-blog-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*.*.*" | |
| paths: | |
| - "__posts/**" | |
| - "__books/**" | |
| permissions: | |
| contents: read | |
| deployments: write | |
| id-token: write | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: 🛡️ Harden the runner | |
| uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 | |
| with: | |
| egress-policy: audit | |
| - name: 📦 Checkout code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: 🇳 Setup Node.js | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
| with: | |
| node-version: "22.20.0" | |
| cache: "npm" | |
| cache-dependency-path: package-lock.json | |
| - name: ⚒️ Setup just | |
| uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3 | |
| with: | |
| just-version: "1.40.0" | |
| - name: ⚙️ Install dependencies | |
| run: just ci | |
| - name: 🏗️ Build production output | |
| run: just build | |
| env: | |
| NEXT_PUBLIC_SITE_URL: https://josimar-silva.com | |
| - name: 🚀 Deploy to Cloudflare Pages | |
| id: deploy | |
| uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
| command: pages deploy dist/blog --project-name=blog --branch=main --commit-hash=${{ github.sha }} --commit-dirty=true |