refactor: version and gh pages #268
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: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
name: Build NuxtJS | |
runs-on: ubuntu-latest | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
WK_TOKEN: ${{ secrets.WK_TOKEN }} | |
SSO_APP_ID: ${{ secrets.SSO_APP_ID }} | |
SSO_APP_REDIRECT: ${{ secrets.SSO_APP_REDIRECT }} | |
SSO_BASE_URL: ${{ secrets.SSO_BASE_URL }} | |
steps: | |
- name: Checkout SourceCode | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "21" | |
cache: ${{ steps.detect-package-manager.outputs.manager }} | |
- uses: pnpm/action-setup@v3 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: true | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
# - name: Collector Data 🔧 | |
# run: pnpm collector | |
- name: Build 🔧 | |
run: pnpm build | |
- name: Upload artifact 🚀 | |
if: success() && github.event_name != 'pull_request' | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./dist | |
# Deployment job | |
deploy: | |
if: github.event_name != 'pull_request' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |