From 32837fe5ae6712bb02b0a1f68d217f8802b13007 Mon Sep 17 00:00:00 2001 From: Milad Nekofar Date: Fri, 11 Aug 2023 20:32:23 +0330 Subject: [PATCH 1/4] ci: add initial commit check to build workflow A new job named 'check' was added to the GitHub Actions build workflow that checks if the current commit is the initial commit of the repository. If it is, the 'Build & Test' job will be skipped. This is done to avoid unnecessary runs for the initial commit as typically it does not contain substantial code to build or test. --- .github/workflows/build.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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' From 4b6aa4efa19325e29d2438ce9779dfa5fd950973 Mon Sep 17 00:00:00 2001 From: Milad Nekofar Date: Fri, 11 Aug 2023 20:33:39 +0330 Subject: [PATCH 2/4] chore: add linting for json and yaml files In this revision, we extended lint-staged configuration to cover JSON and YAML files. The change ensures consistent code formatting across different types of configuration files. --- lint-staged.config.js | 1 + 1 file changed, 1 insertion(+) 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'], } From 60eb9fc3e3d5a804d6abe35c88669433745bcca3 Mon Sep 17 00:00:00 2001 From: Milad Nekofar Date: Fri, 11 Aug 2023 20:47:47 +0330 Subject: [PATCH 3/4] chore: update pre-commit hook and cleanup package.json scripts The "lint:staged" command in the pre-commit hook was updated to "pnpm lint-staged". The "lint:staged" and "format" commands in package.json were removed because they are now being handled directly within the pre-commit hook. This change streamlines the process and reduces unnecessary indirection. --- .husky/pre-commit | 3 ++- package.json | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) 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/package.json b/package.json index a4048ae5..e7bbf8d0 100644 --- a/package.json +++ b/package.json @@ -4,15 +4,10 @@ "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" From d6cd223353783d13bdc38f9c8219045298f12b0c Mon Sep 17 00:00:00 2001 From: Milad Nekofar Date: Fri, 11 Aug 2023 20:53:14 +0330 Subject: [PATCH 4/4] chore(release): prepare for version 1.0.18 --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) 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/package.json b/package.json index e7bbf8d0..eb91fb98 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nextjs-lingui-template", - "version": "1.0.17", + "version": "1.0.18", "private": true, "scripts": { "dev": "next dev",