diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6fc1d78..e73a9d3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,6 +5,15 @@ on: branches: - main +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + jobs: build: name: Build @@ -16,6 +25,9 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm - name: Install dependencies uses: bahmutov/npm-install@v1 @@ -39,34 +51,35 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 + with: + node-version: 18 + cache: npm + + - name: Setup Pages + uses: actions/configure-pages@v3 - name: Install dependencies - uses: bahmutov/npm-install@v1 + run: npm ci - - name: Build project - run: npm run docs:build + - name: Build with VitePress + run: | + npm run docs:build + touch docs/.vitepress/dist/.nojekyll - - name: Upload production-ready build files - uses: actions/upload-artifact@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 with: - name: production-files - path: ./docs/.vitepress/dist + path: docs/.vitepress/dist doc-deploy: name: DocDeploy - needs: doc-build runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' + needs: doc-build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} steps: - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: production-files - path: ./docs/.vitepress/dist - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs/.vitepress/dist \ No newline at end of file + id: deployment + uses: actions/deploy-pages@v2 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 957007a..1659693 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ node_modules dist dist-ssr *.local -docs/.vuepress/.cache +docs/.vuepress/cache docs/.vuepress/.temp types .idea