Skip to content

Commit

Permalink
Renew deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
xingrz committed Mar 25, 2023
1 parent 8834cbd commit c211768
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,48 @@ on:
push:
branches: [ master ]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
deploy:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2

- uses: benjlevesque/short-sha@v1.2
id: short-sha

- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Build
run: npm run build
run: npm ci && npm run build

- name: Publish
uses: crazy-max/ghaction-github-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
target_branch: gh-pages
keep_history: true
allow_empty_commit: false
build_dir: dist
commit_message: "Auto deploy for commit ${{ steps.short-sha.outputs.sha }}"
fqdn: esp.xingrz.me
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
path: dist

deploy:
needs: build
runs-on: ubuntu-latest

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

0 comments on commit c211768

Please sign in to comment.