From 8b445a44c434603abd843debcbeaabdadf40a204 Mon Sep 17 00:00:00 2001 From: Haziq Khairi Date: Wed, 10 Jan 2024 23:11:40 +0800 Subject: [PATCH] build: new yaml --- .github/workflows/deploy-stage.yaml | 58 +++++++++++++++-------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/.github/workflows/deploy-stage.yaml b/.github/workflows/deploy-stage.yaml index ad602cd..ae1a6b0 100644 --- a/.github/workflows/deploy-stage.yaml +++ b/.github/workflows/deploy-stage.yaml @@ -1,41 +1,39 @@ -name: Build and Deploy to GitHub Pages +name: Deploy static content to Pages on: push: - branches: - - main + branches: ['main'] workflow_dispatch: +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: 'pages' + cancel-in-progress: true + jobs: - build-and-deploy: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - - name: Checkout Repository - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: 16 + node-version: '18' + cache: 'pnpm' - name: Install pnpm uses: pnpm/action-setup@v2 with: - version: 8 - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v3 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- + version: '8' - name: Install dependencies run: pnpm install @@ -43,10 +41,14 @@ jobs: - name: Build Static Content run: pnpm run build - - name: Deploy to GitHub Pages - uses: JamesIves/github-pages-deploy-action@v4 + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 with: - token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages - folder: dist - clean: true + path: './dist' # Ensure your build output is in the 'dist' directory + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2