Skip to content

Commit

Permalink
DRY GH workflows
Browse files Browse the repository at this point in the history
fix pre-commit eslint hook when running locally
  • Loading branch information
janosh committed Jun 1, 2023
1 parent 085505d commit c3fa058
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 59 deletions.
39 changes: 4 additions & 35 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,9 @@ on:
branches: [main]
workflow_dispatch:

# set permissions of GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 19
cache: npm
cache-dependency-path: site/package.json

- name: Install dependencies
run: cd site && npm install

- name: Build site
run: cd site && npm run build

- name: Upload build artifact
uses: actions/upload-pages-artifact@v1
with:
path: site/build

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v1
uses: janosh/workflows/.github/workflows/nodejs-gh-pages.yml@main
with:
working-directory: site
install-cmd: npm install -f
25 changes: 4 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,7 @@ on:

jobs:
tests:
runs-on: ubuntu-latest

steps:
- name: Check out repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 19

- name: Install dependencies
run: |
cd site
npm install
npx playwright install chromium
- name: Run tests
run: |
cd site
npm run test
uses: janosh/workflows/.github/workflows/npm-test-release.yml@main
with:
install-cmd: npm install --force
working-directory: site
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ repos:
stages: [commit, commit-msg]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.39.0
rev: v8.41.0
hooks:
- id: eslint
types: [file]
files: \.(svelte|js|ts)$
args: [--fix, --resolve-plugins-relative-to, ~/.cache/pre-commit]
files: \.(js|ts|svelte)$
additional_dependencies:
- eslint
- svelte
- typescript
- eslint-plugin-svelte3
- '@typescript-eslint/eslint-plugin'
Expand Down

0 comments on commit c3fa058

Please sign in to comment.