Skip to content

Commit

Permalink
use github actions for deploying github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
vitormv committed Jan 19, 2024
1 parent 24dd607 commit 97502ce
Showing 1 changed file with 45 additions and 26 deletions.
71 changes: 45 additions & 26 deletions .github/workflows/main.yml
@@ -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

0 comments on commit 97502ce

Please sign in to comment.