code format #23
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 to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] # Trigger on push to the 'main' branch | |
| workflow_dispatch: # Allows manual run from Actions tab | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| # Only run on the original organization repository, not on forks | |
| if: github.repository == 'dailynest/dailynest.github.io' | |
| runs-on: ubuntu-latest | |
| environment: github-pages | |
| steps: | |
| # 1. Checkout code | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 2. Set up Node.js | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "20" | |
| # 3. Create .env file with Giscus secrets | |
| - name: Create .env file | |
| run: | | |
| echo "PUBLIC_GISCUS_REPO=${{ secrets.PUBLIC_GISCUS_REPO }}" >> .env | |
| echo "PUBLIC_GISCUS_REPO_ID=${{ secrets.PUBLIC_GISCUS_REPO_ID }}" >> .env | |
| echo "PUBLIC_GISCUS_CATEGORY=${{ secrets.PUBLIC_GISCUS_CATEGORY }}" >> .env | |
| echo "PUBLIC_GISCUS_CATEGORY_ID=${{ secrets.PUBLIC_GISCUS_CATEGORY_ID }}" >> .env | |
| echo "PUBLIC_GISCUS_MAPPING=${{ secrets.PUBLIC_GISCUS_MAPPING }}" >> .env | |
| echo "PUBLIC_GISCUS_STRICT=${{ secrets.PUBLIC_GISCUS_STRICT }}" >> .env | |
| echo "PUBLIC_GISCUS_REACTIONS_ENABLED=${{ secrets.PUBLIC_GISCUS_REACTIONS_ENABLED }}" >> .env | |
| echo "PUBLIC_GISCUS_EMIT_METADATA=${{ secrets.PUBLIC_GISCUS_EMIT_METADATA }}" >> .env | |
| echo "PUBLIC_GISCUS_INPUT_POSITION=${{ secrets.PUBLIC_GISCUS_INPUT_POSITION }}" >> .env | |
| echo "PUBLIC_GISCUS_THEME=${{ secrets.PUBLIC_GISCUS_THEME }}" >> .env | |
| echo "PUBLIC_GISCUS_LANG=${{ secrets.PUBLIC_GISCUS_LANG }}" >> .env | |
| # 4. Install dependencies and build site | |
| - name: Install dependencies and build site | |
| run: | | |
| npm install | |
| npm run build | |
| # 5. Upload the built site to GitHub Pages (Astro Action) | |
| - name: Upload the built site to GitHub Pages | |
| uses: withastro/action@v3 | |
| with: | |
| node-version: 20 | |
| deploy: | |
| needs: build | |
| # Only run on the original organization repository, not on forks | |
| if: github.repository == 'dailynest/dailynest.github.io' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |