How do I setup a github action to deploy to production and not preview?

Below is my current github action which does work for preview deployments. I'd like to be able to deploy from production for it.
name: Deploy
on:
push:
branches:
- 'releases/**'
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
#
# Build web app
#
- name: Build web
run: pnpm run pages:build
#
# Deploy to Cloudflare Pages
#
- name: Publish
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: project-name
directory: .vercel/output/static
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
name: Deploy
on:
push:
branches:
- 'releases/**'
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
#
# Build web app
#
- name: Build web
run: pnpm run pages:build
#
# Deploy to Cloudflare Pages
#
- name: Publish
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: project-name
directory: .vercel/output/static
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
2 Replies
Walshy
Walshy8mo ago
You can set your production branch to something like "release" and then set branch: release
autumncicada
autumncicadaOP8mo ago
that works, thanks!
Want results from more Discord servers?
Add your server