Skip to content

Commit

Permalink
Add GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
amrabed committed Aug 12, 2024
1 parent 3d144dc commit df8a8f5
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint code

on:
workflow_call:
push:
paths: [next]

defaults:
run:
working-directory: next

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: make pnpm install
- name: Format and lint
run: make lint
59 changes: 59 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy to GitHub Pages
on:
pull_request:
types: [closed]
paths: [next]
branches: [main]

defaults:
run:
working-directory: next

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
check:
uses: ./.github/workflows/check.yml
build:
if: github.event.pull_request.merged == true
needs: [check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup GitHuib Pages
uses: actions/configure-pages@v5
with:
static_site_generator: next
- name: Install dependencies
run: make pnpm install

- name: Build with Next.js
run: pnpm build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
needs: build

steps:
- name: Publish to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion next/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ install:
format:
pnpm format

lint: format
lint:
pnpm lint

local:
Expand Down

0 comments on commit df8a8f5

Please sign in to comment.