Skip to content

Commit

Permalink
add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
neila committed Jan 16, 2024
1 parent 24e0815 commit 7d138d0
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>hatena/renovate-config",
":automergePatch",
":disableRateLimiting"
],
"schedule": ["before 8am on Saturday"],
"labels": ["dependencies"],
"platformAutomerge": true,
"separateMultipleMajor": true,
"lockFileMaintenance": {
"enabled": true
},
"commitMessagePrefix": "chore: ",
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
},
{
"matchDepTypes": ["devDependencies"],
"automerge": true
},
{
"groupName": "linters",
"extends": ["packages:linters"],
"matchPackagePatterns": ["^@typescript-eslint/", "prettier", "stylelint"],
"automerge": true,
"major": { "automerge": false }
},
{
"groupName": "storybook",
"extends": ["monorepo:storybook"],
"matchPackagePatterns": ["^@storybook/", "^storybook-"],
"automerge": true,
"major": { "automerge": false }
}
]
}
34 changes: 34 additions & 0 deletions .github/workflows/_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on: workflow_call

jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
${{ github.workspace }}/node_modules
${{ github.workspace }}/.yarn/cache
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-nodemodules
- name: Install packages
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable

check:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/node_modules
${{ github.workspace }}/.yarn/cache
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-nodemodules
- name: tsc/lint/format check
run: yarn tsc && yarn run biome ci .
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: check

on:
push:
branches: "!main"

jobs:
ci:
uses: ./.github/workflows/_ci.yml

build:
runs-on: ubuntu-latest
needs: ci
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/node_modules
${{ github.workspace }}/.yarn/cache
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-nodemodules
- uses: actions/cache@v3
id: build-cache
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-next-build-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-next-build-
- name: Run build
if: steps.build-cache.outputs.cache-hit != 'true'
run: yarn turbo build
env:
NODE_ENV: development
NEXT_PUBLIC_AIRTABLE_API_KEY: ${{ vars.NEXT_PUBLIC_AIRTABLE_API_KEY }}
NEXT_PUBLIC_AIRTABLE_BASE_INQUIRYFORM: ${{ vars.NEXT_PUBLIC_AIRTABLE_BASE_INQUIRYFORM }}
NEXT_PUBLIC_AIRTABLE_TABLE_INQUIRYFORM: ${{ vars.NEXT_PUBLIC_AIRTABLE_TABLE_INQUIRYFORM }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
57 changes: 57 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy site

on:
push:
branches: [main]
workflow_dispatch:

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

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

jobs:
ci:
uses: ./.github/workflows/_ci.yml

build:
runs-on: ubuntu-latest
needs: ci
steps:
- uses: actions/checkout@v3
- uses: actions/configure-pages@v3
with:
static_site_generator: next
- uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/node_modules
${{ github.workspace }}/.yarn/cache
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-nodemodules
- name: build
run: yarn build-static
env:
NODE_ENV: production
NEXT_PUBLIC_AIRTABLE_API_KEY: ${{ vars.NEXT_PUBLIC_AIRTABLE_API_KEY }}
NEXT_PUBLIC_AIRTABLE_BASE_INQUIRYFORM: ${{ vars.NEXT_PUBLIC_AIRTABLE_BASE_INQUIRYFORM }}
NEXT_PUBLIC_AIRTABLE_TABLE_INQUIRYFORM: ${{ vars.NEXT_PUBLIC_AIRTABLE_TABLE_INQUIRYFORM }}

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./out

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

0 comments on commit 7d138d0

Please sign in to comment.