diff --git a/.github/workflows/deploy-stage.yaml b/.github/workflows/deploy-stage.yaml new file mode 100644 index 0000000..bc1866f --- /dev/null +++ b/.github/workflows/deploy-stage.yaml @@ -0,0 +1,45 @@ +name: Build and Deploy to GitHub Pages + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + cache: 'pnpm' + + - name: Cache pnpm Store + uses: actions/cache@v1 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + + - name: Install pnpm + run: npm install -g pnpm + + - name: Install Dependencies + run: pnpm install + + - name: Build Static Content + run: pnpm run build + + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@4.1.4 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: dist + CLEAN: true diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml deleted file mode 100644 index 02d9cfe..0000000 --- a/.github/workflows/deploy.yaml +++ /dev/null @@ -1,51 +0,0 @@ -name: Deploy - -on: - push: - branches: - - main - -jobs: - build: - name: Build - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v2 - - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 16 - - - name: Install dependencies - uses: bahmutov/npm-install@v1 - - - name: Build project - run: npm run build - - - name: Upload production-ready build files - uses: actions/upload-artifact@v2 - with: - name: production-files - path: ./dist - - deploy: - name: Deploy - needs: build - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' - - steps: - - name: Download artifact - uses: actions/download-artifact@v2 - with: - name: production-files - path: ./dist - - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist