diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da711f62..8887e7d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,10 +13,26 @@ on: workflow_dispatch: # Allows you to run this workflow manually from the Actions tab. jobs: + check: + runs-on: ubuntu-latest + steps: + - name: Check Initial Commit + id: check_initial_commit + run: | + if [ "$(git rev-list --count HEAD)" -eq 1 ]; then + echo "This is the initial commit." + echo "skip_ci=true" >> $GITHUB_ENV + else + echo "skip_ci=false" >> $GITHUB_ENV + fi + build: # Job named 'build' name: Build & Test + if: needs.check_initial_commit.outputs.skip_ci != 'true' runs-on: ubuntu-latest # The type of machine to run the job on. + needs: [check] + strategy: # Allows you to create a matrix for job configuration. matrix: node-version: [18.x, 19.x, 20.x] # Running tests across different environments. @@ -100,7 +116,7 @@ jobs: run: | version=$(jq -r '.version' package.json) echo "version=${version}" >> $GITHUB_OUTPUT - + # Read contents of changelog into variable 'changelog_content' changelog=$(cat ${{ steps.git-cliff.outputs.changelog }}) # Remove first two lines from 'changelog' diff --git a/.husky/pre-commit b/.husky/pre-commit index 2b27084e..41d08db6 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,6 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -pnpm run lint:staged +pnpm lingui extract $(git diff --name-only --staged) +pnpm lint-staged pnpm test diff --git a/CHANGELOG.md b/CHANGELOG.md index 09952ed8..a7e9a7ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. +## [1.0.18] - 2023-08-11 + +### Continuous Integrations + +- Add initial commit check to build workflow + +### Miscellaneous Tasks + +- Add linting for json and yaml files +- Update pre-commit hook and cleanup package.json scripts + ## [1.0.17] - 2023-08-11 ### Continuous Integrations diff --git a/lint-staged.config.js b/lint-staged.config.js index c1a636f6..6d849eb4 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -8,4 +8,5 @@ const buildEslintCommand = (filenames) => module.exports = { '*.{js,jsx,ts,tsx}': [buildEslintCommand, 'prettier --write'], '*.{md,mdx}': ['prettier --write'], + '*.{json,yaml,yml}': ['prettier --write'], } diff --git a/package.json b/package.json index a4048ae5..eb91fb98 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,13 @@ { "name": "nextjs-lingui-template", - "version": "1.0.17", + "version": "1.0.18", "private": true, "scripts": { "dev": "next dev", - "prebuild": "pnpm run lingui:extract", "build": "next build", "prestart": "pnpm run build", "start": "serve out", "lint": "next lint", - "lint:staged": "lint-staged", - "lingui:extract": "lingui extract --clean", - "lingui:compile": "lingui compile", - "format": "prettier --log-level error --write .", "test": "jest", "preinstall": "pnpx typesync || :", "prepare": "husky install"