-
Is there a way to only run the deploy on main branch? I have this configuration but it also runs when a new pull request is created, could somebody point me out to the right direction?
I don't know if this is relevant but I'm using nuxtjs static pages. |
Beta Was this translation helpful? Give feedback.
Answered by
peaceiris
Jul 20, 2021
Replies: 2 comments 3 replies
-
The latest README mentions this already. name: GitHub Pages
on:
push:
branches:
- main # Set a branch name to trigger deployment
pull_request:
jobs:
deploy:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v2
...
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
+ if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
simonppg
-
Thanks for the response, I made the change and it stop deploying on all branches even on main branch. name: cd
on:
push:
branches:
- main # Set a branch name to trigger deployment
pull_request:
jobs:
cd:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [14]
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup node env
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm install
- name: Generate
run: npm run generate
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
+ if: github.ref == 'ref/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The latest README mentions this already.
name: GitHub Pages on: push: branches: - main # Set a branch name to trigger deployment pull_request: jobs: deploy: runs-on: ubuntu-20.04 concurrency: group: ${{ github.workflow }}-${{ github.ref }} steps: - uses: actions/checkout@v2 ... - name: Deploy uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.ref == 'refs/heads/main' }} with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public