Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use github actions for deploying github pages
- Loading branch information
Showing
1 changed file
with
45 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,58 @@ | ||
name: CI | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
permissions: | ||
contents: write | ||
|
||
# Only trigger this script when you push to the master branch | ||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: [main] | ||
branches: ['main'] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: 'pages' | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
|
||
# Download our master branch | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
cache: 'yarn' | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- run: yarn install | ||
- run: yarn lint | ||
- run: yarn test | ||
|
||
- name: Setup git credentials | ||
env: # use github secrets as env variable | ||
GIT_NAME: ${{ secrets.GIT_NAME }} | ||
GIT_EMAIL: ${{ secrets.GIT_EMAIL }} | ||
run: | | ||
git config --global user.name "$GIT_NAME" | ||
git config --global user.email "$GIT_EMAIL" | ||
# Run our deployment command | ||
- name: Deploying the static website to gh-pages | ||
env: | ||
FILTER_BRANCH_SQUELCH_WARNING: 1 | ||
run: | | ||
yarn build && bash ./cli/gh-pages-deploy.sh | ||
- name: Build | ||
run: yarn build | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: './dist' | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |