Skip to content

Instantly share code, notes, and snippets.

@cjfswd
Last active June 3, 2022 13:58
Show Gist options
  • Save cjfswd/c4c4e7d8af4ca84d664e318b587a42e3 to your computer and use it in GitHub Desktop.
Save cjfswd/c4c4e7d8af4ca84d664e318b587a42e3 to your computer and use it in GitHub Desktop.
github action to deploy with github pages
name: deploy
on:
# Triggers the workflow on push
push:
branches:
- development
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
environment: app
name: build and push
steps:
- name: git-checkout
uses: actions/checkout@v3
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: install dependencies
run: npm install
- name: build
run: npm run generate # The build command of your project
- name: push
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: deploy # The branch name where you want to push the assets
SQUASH_HISTORY: true
FOLDER: .output/public # The directory where your assets are generated
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment