Deploying to pages with github actions: Branch Settings

Hello all I have a question regarding deployment with github actions. I set the branch as branch: production but cloudflare pages is still deploying it as preview How can I get around this? Here is the current .yml file for the github actions
name: Build and Deploy to Cloudflare Pages on Release

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
# checkout staging branch and build using npm with node 16
# set process.env.CI = false to prevent build from failing
- name: Checkout
uses: actions/checkout@v2
with:
ref: staging
- name: Use Node.js 16
uses: actions/setup-node@v2
with:
node-version: 16
- name: Set CI to false
run: echo "CI=false" >> $GITHUB_ENV
- name: Install dependencies
run: yarn install
# npx browserslist@latest --update-db
- name: update browserslist
run: npx browserslist@latest --update-db
- name: Build
run: yarn build
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ACCOUNT_ID
branch: production
projectName: cortex-web-app
directory: build
name: Build and Deploy to Cloudflare Pages on Release

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
# checkout staging branch and build using npm with node 16
# set process.env.CI = false to prevent build from failing
- name: Checkout
uses: actions/checkout@v2
with:
ref: staging
- name: Use Node.js 16
uses: actions/setup-node@v2
with:
node-version: 16
- name: Set CI to false
run: echo "CI=false" >> $GITHUB_ENV
- name: Install dependencies
run: yarn install
# npx browserslist@latest --update-db
- name: update browserslist
run: npx browserslist@latest --update-db
- name: Build
run: yarn build
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ACCOUNT_ID
branch: production
projectName: cortex-web-app
directory: build
2 Replies
Jay
JayOP2y ago
Ok, I solved it with setting branch: main interestingly, pages is not taking production as production deployment. Maybe the wording can be improved there with also allowing production keyword to be deployed to production
Hello, I’m Allie!
IIRC, the default branch is main, but if you set up via wrangler, you should be able to set a different branch as the “main” one
Want results from more Discord servers?
Add your server