Merge pull request #19 from deco-sites/jonasjesus/deco-5273-loading-f… #22
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 | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: deploy-main | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Generate lockfile if missing | |
| if: hashFiles('package-lock.json') == '' | |
| run: npm install --package-lock-only | |
| - name: Restore npm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: npm-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
| restore-keys: npm-${{ runner.os }}- | |
| - name: Sync lockfile and install | |
| run: | | |
| npm install --package-lock-only | |
| if ! git diff --quiet package-lock.json 2>/dev/null; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add package-lock.json | |
| git commit -m "chore: sync package-lock.json" | |
| git push || echo "Lockfile push failed (remote ahead); proceeding with deploy" | |
| fi | |
| npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Deploy to Cloudflare Workers | |
| run: npx wrangler deploy --var BUILD_HASH:$(git rev-parse --short HEAD) | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |