ci: fix if #834
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: build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Versioning | |
run: | | |
VERSION=$(git describe --tags --abbrev=8 --always) | |
VERSION=${VERSION#v} | |
echo "Version: $VERSION" | |
jq --arg version "$VERSION" '.version = $version' package.json > tmp.$$.json && mv tmp.$$.json package.json | |
- name: Install dependencies | |
uses: wyvox/action-setup-pnpm@v3 | |
- name: Optimize assets | |
run: pnpm optimize | |
- name: Build docs | |
env: | |
DOCS_BASE_URL: /${{ github.event.repository.name }}/ | |
DOCS_HOME_URL: https://cloudpss.net/ | |
run: | | |
pnpm build | |
touch build/.nojekyll | |
- name: Upload static files as artifact | |
id: deployment | |
if: (!cancelled()) | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: build/ | |
deploy: | |
needs: build | |
if: (!cancelled() && github.event_name == 'push') | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
if: (!cancelled()) | |
uses: actions/deploy-pages@v4 |