Skip to content

Merge pull request #33 from deco-sites/jonasjesus/fix-deco-events-dis… #26

Merge pull request #33 from deco-sites/jonasjesus/fix-deco-events-dis…

Merge pull request #33 from deco-sites/jonasjesus/fix-deco-events-dis… #26

Workflow file for this run

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 }}