🔧 update front matter config #27
This file contains 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: GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
environment: | |
name: github-pages | |
url: https://genomagames.com | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
# https://nextjs.org/docs/advanced-features/ci-build-caching#github-actions | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
${{ github.workspace }}/.next/cache | |
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install dependencies | |
run: npm ci | |
- name: Generate .env file | |
run: | | |
touch .env | |
echo NEXT_PUBLIC_BASE_URL=${{ secrets.NEXT_PUBLIC_BASE_URL }} >> .env | |
echo NEXT_PUBLIC_COPYRIGHT=${{ secrets.NEXT_PUBLIC_COPYRIGHT }} >> .env | |
echo NEXT_PUBLIC_DISQUS_SHORTNAME=${{ secrets.NEXT_PUBLIC_DISQUS_SHORTNAME }} >> .env | |
echo NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }} >> .env | |
echo NEXT_PUBLIC_POSTS_PER_PAGE=${{ secrets.NEXT_PUBLIC_POSTS_PER_PAGE }} >> .env | |
echo NEXT_PUBLIC_SHOW_DRAFTS=${{ secrets.NEXT_PUBLIC_SHOW_DRAFTS }} >> .env | |
echo NEXT_PUBLIC_SITE_NAME=${{ secrets.NEXT_PUBLIC_SITE_NAME }} >> .env | |
echo NEXT_PUBLIC_TWITTER_USERNAME=${{ secrets.NEXT_PUBLIC_TWITTER_USERNAME }} >> .env | |
echo NEXT_PUBLIC_TWITTER_SHARE_POST_HASHTAGS=${{ secrets.NEXT_PUBLIC_TWITTER_SHARE_POST_HASHTAGS }} >> .env | |
- name: Build | |
run: npm run build | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./out |