ci: release #14
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
name: Github Pages | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages。 | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# 允许一个并发的部署 | |
concurrency: | |
group: pages | |
cancel-in-progress: true | |
jobs: | |
build: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set ENV variables | |
run: | | |
echo "REPO_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_ENV | |
- name: Use the custom ENV variable | |
run: | | |
echo $REPO_NAME | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
cache: pnpm | |
- name: Install | |
run: pnpm install | |
- name: Build | |
run: npx vite build --base=/${{ env.REPO_NAME }}/ | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
# Upload dist repository | |
path: ./dist | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
# Upload dist repository | |
path: ./dist | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |