From 5fe64aecb35eda8a3b3ee3bb9fae36ace5c5cfee Mon Sep 17 00:00:00 2001 From: Ariful Alam Date: Sat, 20 Aug 2022 15:53:55 +0600 Subject: [PATCH] Deploy with custom GitHub Actions workflow --- .github/workflows/deploy.yml | 44 ++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 106eb50..f2679c0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,14 +1,22 @@ -name: Deploy to gh-pages Branch +name: Deploy to GitHub Pages on: push: branches: [main] + workflow_dispatch: + permissions: - contents: write + contents: read + pages: write + id-token: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - deploy: + build: runs-on: ubuntu-latest steps: - name: Checkout repository @@ -18,9 +26,13 @@ jobs: uses: actions/setup-node@v3 with: node-version: 16.x + cache: 'npm' - - name: Cache dependencies - uses: actions/cache@v2 + - name: Setup Pages + uses: actions/configure-pages@v1 + + - name: Restore cache + uses: actions/cache@v3 with: path: | **/node_modules @@ -29,13 +41,21 @@ jobs: - name: Install dependencies run: npm ci - - name: Build + - name: Build with vite run: npm run build - env: - CI: '' - - name: Deploy - uses: JamesIves/github-pages-deploy-action@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 with: - branch: gh-pages - folder: dist + path: ./dist + + deploy: + 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@v1