Merge pull request #25 from theintrance/hyunwook/2024-11-18 #36
This file contains hidden or 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: Deploy Astro site to Pages | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| env: | |
| BUILD_PATH: "astro" | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Run build script | |
| run: ./build.sh | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Detect package manager | |
| id: detect-package-manager | |
| run: | | |
| if [ -f "${{ github.workspace }}/astro/pnpm-lock.yaml" ]; then | |
| echo "manager=pnpm" >> $GITHUB_OUTPUT | |
| echo "command=install" >> $GITHUB_OUTPUT | |
| echo "runner=pnpm" >> $GITHUB_OUTPUT | |
| else | |
| echo "Unable to determine package manager" | |
| exit 1 | |
| fi | |
| - name: Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "22" | |
| cache: "pnpm" | |
| cache-dependency-path: ${{ env.BUILD_PATH }}/pnpm-lock.yaml | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v3 | |
| - name: Install dependencies | |
| run: pnpm install | |
| working-directory: ${{ env.BUILD_PATH }} | |
| - name: Build with Astro | |
| run: | | |
| pnpm astro build \ | |
| --site "${{ steps.pages.outputs.origin }}${{ steps.pages.outputs.base_path }}/" \ | |
| --base "${{ steps.pages.outputs.base_path }}" | |
| working-directory: ${{ env.BUILD_PATH }} | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v1 | |
| with: | |
| path: ${{ env.BUILD_PATH }}/dist | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| needs: build | |
| runs-on: ubuntu-latest | |
| name: Deploy | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v1 |