[Deno Deploy] Add .github/workflows/deploy.yml #31
Workflow file for this run
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: Deploy Shafin's Portfolio | |
on: | |
push: | |
branches: ['v2'] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 'lts/*' | |
- name: Install dependencies | |
run: yarn install | |
# Generate Prisma Client | |
- name: Generate Prisma Client | |
run: npx prisma generate | |
- name: Build with Next.js | |
run: yarn next build | |
- name: Export static HTML | |
run: yarn next export | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: out | |
path: out | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 'lts/*' | |
- name: Deploy to GitHub Pages | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git clone https://github.com/${{ github.repository }}.git gh-pages | |
cd gh-pages | |
git checkout gh-pages || git checkout --orphan gh-pages | |
rm -rf ./* | |
cp -r ../out/* . | |
git add . | |
git commit -m "Deploy GitHub Pages" | |
git push origin gh-pages | |
env: | |
GITHUB_ID: ${{ secrets.SHAFIN_GITHUB_ID }} | |
GITHUB_SECRET: ${{ secrets.SHAFIN_GITHUB_SECRET }} | |
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} |