Remove Discord and Email social icons #89
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: ["Development"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| env: | |
| BUILD_PATH: "." | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Detect package manager | |
| id: detect-package-manager | |
| run: | | |
| if [ -f "${{ github.workspace }}/yarn.lock" ]; then | |
| echo "manager=yarn" >> $GITHUB_OUTPUT | |
| echo "command=install" >> $GITHUB_OUTPUT | |
| echo "runner=yarn" >> $GITHUB_OUTPUT | |
| echo "lockfile=yarn.lock" >> $GITHUB_OUTPUT | |
| exit 0 | |
| elif [ -f "${{ github.workspace }}/package.json" ]; then | |
| echo "manager=npm" >> $GITHUB_OUTPUT | |
| echo "command=ci" >> $GITHUB_OUTPUT | |
| echo "runner=npx --no-install" >> $GITHUB_OUTPUT | |
| echo "lockfile=package-lock.json" >> $GITHUB_OUTPUT | |
| exit 0 | |
| else | |
| echo "Unable to determine package manager" | |
| exit 1 | |
| fi | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: ${{ steps.detect-package-manager.outputs.manager }} | |
| cache-dependency-path: ${{ env.BUILD_PATH }}/${{ steps.detect-package-manager.outputs.lockfile }} | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v5 | |
| - name: Install dependencies | |
| run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} --force | |
| working-directory: ${{ env.BUILD_PATH }} | |
| - name: Update Astro and dependencies | |
| run: ${{ steps.detect-package-manager.outputs.manager }} install astro@latest @astrojs/tailwind@latest @astrojs/react@latest @astrojs/rss@latest | |
| working-directory: ${{ env.BUILD_PATH }} | |
| - name: Fetch GitHub repo metadata | |
| # use GH_PAT secret if set, otherwise fall back to the built-in token | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }} | |
| run: | | |
| node <<'NODE' | |
| const fs = require('fs'); | |
| const repos = ['c0mebackf0lders','pixeljellyfish.dev','repo','OS-Stuff']; | |
| (async () => { | |
| const out = []; | |
| for (const r of repos) { | |
| try { | |
| const url = `https://api.github.com/repos/pixeljellyfish/${r}`; | |
| const headers = process.env.GH_TOKEN ? { Authorization: `token ${process.env.GH_TOKEN}` } : undefined; | |
| const res = await fetch(url, headers ? { headers } : undefined); | |
| if (res.ok) { | |
| const d = await res.json(); | |
| out.push({ name: d.name, full_name: d.full_name, description: d.description, stargazers_count: d.stargazers_count }); | |
| } else { | |
| console.warn('GitHub fetch failed for', r, res.status); | |
| } | |
| } catch (e) { | |
| console.warn('Error fetching', r, e.message || e); | |
| } | |
| } | |
| fs.mkdirSync('src/data', { recursive: true }); | |
| fs.writeFileSync('src/data/repos.json', JSON.stringify(out, null, 2)); | |
| console.log('Wrote src/data/repos.json'); | |
| })(); | |
| NODE | |
| - name: Build with Astro and copy to public | |
| run: | | |
| ${{ steps.detect-package-manager.outputs.runner }} astro build \ | |
| --site "${{ steps.pages.outputs.origin }}" \ | |
| --base "/" | |
| rm -rf public/* && cp -r dist/* public/ | |
| working-directory: ${{ env.BUILD_PATH }} | |
| env: | |
| # pass the same token used earlier (fallback to built-in token if GH_PAT not provided) | |
| GH_TOKEN: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }} | |
| OPENWEATHER_API_KEY: ${{ secrets.OPENWEATHER_API_KEY }} | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ${{ env.BUILD_PATH }}/public | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| name: Deploy | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |