Skip to content

Merge pull request #47 from gunamata/fix-ci-failure #48

Merge pull request #47 from gunamata/fix-ci-failure

Merge pull request #47 from gunamata/fix-ci-failure #48

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Set Custom Domain Environment Variable
run: |
# Extract custom domain from your repository settings
CUSTOM_DOMAIN=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pages" | jq -r '.cname')
if [ -n "$CUSTOM_DOMAIN" ] && [ "$CUSTOM_DOMAIN" != "null" ]; then
echo "NEXT_PUBLIC_CUSTOM_DOMAIN=$CUSTOM_DOMAIN" >> $GITHUB_ENV
fi
- name: Install packages
run: npm ci
- name: Build project
run: npm run build
- name: Export static files
run: npm run export
- name: Add .nojekyll file
run: touch ./out/.nojekyll
- name: Create CNAME File
run: |
# Check if NEXT_PUBLIC_CUSTOM_DOMAIN environment variable is set
if [[ -n $NEXT_PUBLIC_CUSTOM_DOMAIN ]]; then
echo "$NEXT_PUBLIC_CUSTOM_DOMAIN" > ./out/CNAME
fi
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./out
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v2