From af0b9e582fb25e213449ba188950a7fb8a49c394 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 16:19:01 +0200 Subject: [PATCH 01/16] fix: dont use latest dist-tags for pre-releases --- .github/workflows/release.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd4e3b3..cbd87e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,12 +17,24 @@ jobs: - run: npm ci - name: Extract version from tag run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + - name: Check for pre-release + id: check_pre_release + run: | + if [[ "${{ env.RELEASE_VERSION }}" == *-* ]]; then + echo "IS_PRE_RELEASE=true" >> $GITHUB_ENV + echo "RELEASE_TAG=next" >> $GITHUB_ENV + else + echo "IS_PRE_RELEASE=false" >> $GITHUB_ENV + echo "RELEASE_TAG=latest" >> $GITHUB_ENV + fi - run: npm version ${{ env.RELEASE_VERSION }} --no-git-tag-version - run: npm run build - - run: npm publish + - name: Publish to npm + run: npm publish --tag ${{ env.RELEASE_TAG }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Commit and push version bump + if: env.IS_PRE_RELEASE == 'false' run: | git checkout -b version-bump/${{ env.RELEASE_VERSION }} git add package.json @@ -31,9 +43,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # This step will only run if all previous steps have succeeded + # This step will only run if all previous steps have succeeded and if it's not a pre-release - name: Create Pull Request for Version Bump - if: success() + if: success() && env.IS_PRE_RELEASE == 'false' uses: peter-evans/create-pull-request@v6 with: commit-message: Update package version to ${{ env.RELEASE_VERSION }} From e9ceae988badca51302a6a8ec32951da30c75ac4 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 16:20:52 +0200 Subject: [PATCH 02/16] ci: auto-merge the version bump PR --- .github/workflows/release.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cbd87e7..854c0fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,8 +42,6 @@ jobs: git push origin version-bump/${{ env.RELEASE_VERSION }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # This step will only run if all previous steps have succeeded and if it's not a pre-release - name: Create Pull Request for Version Bump if: success() && env.IS_PRE_RELEASE == 'false' uses: peter-evans/create-pull-request@v6 @@ -55,3 +53,12 @@ jobs: labels: version-bump token: ${{ secrets.GITHUB_TOKEN }} base: main + + # Automatically enable auto-merge on the created PR with the version bump + - name: Enable Auto-Merge + if: success() && env.IS_PRE_RELEASE == 'false' + uses: peter-evans/enable-pull-request-automerge@v2 + with: + pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }} + token: ${{ secrets.GITHUB_TOKEN }} + merge-method: squash From 5abc0fa0caa1c18d6dca6e135005c7b23da04f0b Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 16:38:16 +0200 Subject: [PATCH 03/16] ci: get the correct pull request number --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 854c0fc..bd0fce9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,8 +42,10 @@ jobs: git push origin version-bump/${{ env.RELEASE_VERSION }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Create a Pull Request with the version bump if the release is not a pre-release - name: Create Pull Request for Version Bump if: success() && env.IS_PRE_RELEASE == 'false' + id: create_pull_request uses: peter-evans/create-pull-request@v6 with: commit-message: Update package version to ${{ env.RELEASE_VERSION }} @@ -53,8 +55,7 @@ jobs: labels: version-bump token: ${{ secrets.GITHUB_TOKEN }} base: main - - # Automatically enable auto-merge on the created PR with the version bump + # Auto-merge the Pull Request with the version bump if the release is not a pre-release - name: Enable Auto-Merge if: success() && env.IS_PRE_RELEASE == 'false' uses: peter-evans/enable-pull-request-automerge@v2 From ea3bc3c539974806cb9420da82977011c746ee92 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 16:40:21 +0200 Subject: [PATCH 04/16] fix: save the version bump in package.json as well --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd0fce9..77da5bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,7 @@ jobs: if: env.IS_PRE_RELEASE == 'false' run: | git checkout -b version-bump/${{ env.RELEASE_VERSION }} - git add package.json + git add package.json package-lock.json git commit -m "chore: bump version to ${{ env.RELEASE_VERSION }}" git push origin version-bump/${{ env.RELEASE_VERSION }} env: From 076ef644368792d55a7a0838386a980411605ecc Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 16:41:07 +0200 Subject: [PATCH 05/16] ci: delete the version bump branch --- .github/workflows/release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77da5bc..fab82c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,3 +63,11 @@ jobs: pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }} token: ${{ secrets.GITHUB_TOKEN }} merge-method: squash + + # Clean up the version bump branch after merge + - name: Delete Version Bump Branch + if: success() && env.IS_PRE_RELEASE == 'false' + run: | + git push origin --delete version-bump/${{ env.RELEASE_VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e60e9143220fb070726283f8871fb2ff62ca1795 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 16:41:48 +0200 Subject: [PATCH 06/16] ci: add linebreaks for readability --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fab82c3..5c98596 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,6 +42,7 @@ jobs: git push origin version-bump/${{ env.RELEASE_VERSION }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Create a Pull Request with the version bump if the release is not a pre-release - name: Create Pull Request for Version Bump if: success() && env.IS_PRE_RELEASE == 'false' @@ -55,6 +56,7 @@ jobs: labels: version-bump token: ${{ secrets.GITHUB_TOKEN }} base: main + # Auto-merge the Pull Request with the version bump if the release is not a pre-release - name: Enable Auto-Merge if: success() && env.IS_PRE_RELEASE == 'false' From a68bc35737ed04327f1fa3fb64d44cdb0c59d187 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 16:59:09 +0200 Subject: [PATCH 07/16] ci: get the pull request number --- .github/workflows/release.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c98596..4aef41b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,9 @@ name: Publish Package to npmjs on: release: types: [created] +permissions: + contents: write + pull-requests: write jobs: build: runs-on: ubuntu-latest @@ -47,7 +50,7 @@ jobs: - name: Create Pull Request for Version Bump if: success() && env.IS_PRE_RELEASE == 'false' id: create_pull_request - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v7 with: commit-message: Update package version to ${{ env.RELEASE_VERSION }} title: "chore: update package version to ${{ env.RELEASE_VERSION }}" @@ -59,14 +62,14 @@ jobs: # Auto-merge the Pull Request with the version bump if the release is not a pre-release - name: Enable Auto-Merge - if: success() && env.IS_PRE_RELEASE == 'false' - uses: peter-evans/enable-pull-request-automerge@v2 + if: success() && env.IS_PRE_RELEASE == 'false' && steps.create_pull_request.outputs.pull-request-number + uses: peter-evans/enable-pull-request-automerge@v3 with: pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }} token: ${{ secrets.GITHUB_TOKEN }} merge-method: squash - # Clean up the version bump branch after merge + # Clean up the version bump branch after merge - name: Delete Version Bump Branch if: success() && env.IS_PRE_RELEASE == 'false' run: | From d4fce4e7958179ac21b34bb5cdfb58538ff7d83a Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 17:00:11 +0200 Subject: [PATCH 08/16] ci: add notes about GITHUB_TOKEN --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4aef41b..aa10389 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,7 @@ name: Publish Package to npmjs on: release: types: [created] +# Permissions set for the GITHUB_TOKEN (these might also be set on the GitHub Account) permissions: contents: write pull-requests: write From 25967cdb9bec92bc77579232d473e3cf63b9918d Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 17:06:13 +0200 Subject: [PATCH 09/16] ci: remove permissions declaration --- .github/workflows/release.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aa10389..88ec962 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,10 +2,6 @@ name: Publish Package to npmjs on: release: types: [created] -# Permissions set for the GITHUB_TOKEN (these might also be set on the GitHub Account) -permissions: - contents: write - pull-requests: write jobs: build: runs-on: ubuntu-latest @@ -63,7 +59,7 @@ jobs: # Auto-merge the Pull Request with the version bump if the release is not a pre-release - name: Enable Auto-Merge - if: success() && env.IS_PRE_RELEASE == 'false' && steps.create_pull_request.outputs.pull-request-number + if: success() && env.IS_PRE_RELEASE == 'false' uses: peter-evans/enable-pull-request-automerge@v3 with: pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }} From 1b1f7ea2c30cf9debffaaab2872e5de388ed4c15 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 17:11:05 +0200 Subject: [PATCH 10/16] ci: remove auto-merge --- .github/workflows/release.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88ec962..93d56cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,20 +56,3 @@ jobs: labels: version-bump token: ${{ secrets.GITHUB_TOKEN }} base: main - - # Auto-merge the Pull Request with the version bump if the release is not a pre-release - - name: Enable Auto-Merge - if: success() && env.IS_PRE_RELEASE == 'false' - uses: peter-evans/enable-pull-request-automerge@v3 - with: - pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }} - token: ${{ secrets.GITHUB_TOKEN }} - merge-method: squash - - # Clean up the version bump branch after merge - - name: Delete Version Bump Branch - if: success() && env.IS_PRE_RELEASE == 'false' - run: | - git push origin --delete version-bump/${{ env.RELEASE_VERSION }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f03b8ef890537815479872f03c7191d026096cf0 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 17:21:00 +0200 Subject: [PATCH 11/16] ci: bring back auto-merge --- .github/workflows/release.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93d56cf..e02a121 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,6 +43,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Show diff for debugging + run: git diff + # Create a Pull Request with the version bump if the release is not a pre-release - name: Create Pull Request for Version Bump if: success() && env.IS_PRE_RELEASE == 'false' @@ -56,3 +59,20 @@ jobs: labels: version-bump token: ${{ secrets.GITHUB_TOKEN }} base: main + + # Auto-merge the Pull Request with the version bump if the release is not a pre-release + - name: Enable Auto-Merge + if: success() && env.IS_PRE_RELEASE == 'false' + uses: peter-evans/enable-pull-request-automerge@v3 + with: + pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }} + token: ${{ secrets.GITHUB_TOKEN }} + merge-method: squash + + # Clean up the version bump branch after merge + - name: Delete Version Bump Branch + if: success() && env.IS_PRE_RELEASE == 'false' + run: | + git push origin --delete version-bump/${{ env.RELEASE_VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 5a9d8dbf495da0236f9dc446b19a1d27e24712f5 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 17:27:39 +0200 Subject: [PATCH 12/16] ci: add debugging step --- .github/workflows/release.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e02a121..3cecb1b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,8 +43,11 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Show diff for debugging - run: git diff + - name: Show package.json and package-lock.json changes + run: | + cat package.json + cat package-lock.json + git diff # Create a Pull Request with the version bump if the release is not a pre-release - name: Create Pull Request for Version Bump From e1a2fd8b0be1ace80d3a56c912a64f330634032e Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 17:45:09 +0200 Subject: [PATCH 13/16] ci: dont let npm publish commit --- .github/workflows/release.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3cecb1b..1d5c406 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: echo "IS_PRE_RELEASE=false" >> $GITHUB_ENV echo "RELEASE_TAG=latest" >> $GITHUB_ENV fi - - run: npm version ${{ env.RELEASE_VERSION }} --no-git-tag-version + - run: npm version ${{ env.RELEASE_VERSION }} --no-git-tag-version --no-commit - run: npm run build - name: Publish to npm run: npm publish --tag ${{ env.RELEASE_TAG }} @@ -43,12 +43,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Show package.json and package-lock.json changes - run: | - cat package.json - cat package-lock.json - git diff - # Create a Pull Request with the version bump if the release is not a pre-release - name: Create Pull Request for Version Bump if: success() && env.IS_PRE_RELEASE == 'false' From 64b21dcda685517f646a7a64789a3dc8378513f9 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 17:50:30 +0200 Subject: [PATCH 14/16] ci: remove PR requirement --- .github/workflows/release.yml | 33 +-------------------------------- README.md | 2 +- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d5c406..e4f7297 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: echo "IS_PRE_RELEASE=false" >> $GITHUB_ENV echo "RELEASE_TAG=latest" >> $GITHUB_ENV fi - - run: npm version ${{ env.RELEASE_VERSION }} --no-git-tag-version --no-commit + - run: npm version ${{ env.RELEASE_VERSION }} --no-git-tag-version - run: npm run build - name: Publish to npm run: npm publish --tag ${{ env.RELEASE_TAG }} @@ -42,34 +42,3 @@ jobs: git push origin version-bump/${{ env.RELEASE_VERSION }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # Create a Pull Request with the version bump if the release is not a pre-release - - name: Create Pull Request for Version Bump - if: success() && env.IS_PRE_RELEASE == 'false' - id: create_pull_request - uses: peter-evans/create-pull-request@v7 - with: - commit-message: Update package version to ${{ env.RELEASE_VERSION }} - title: "chore: update package version to ${{ env.RELEASE_VERSION }}" - body: "Updates `package.json` version to `${{ env.RELEASE_VERSION }}`." - branch: version-bump/${{ env.RELEASE_VERSION }} - labels: version-bump - token: ${{ secrets.GITHUB_TOKEN }} - base: main - - # Auto-merge the Pull Request with the version bump if the release is not a pre-release - - name: Enable Auto-Merge - if: success() && env.IS_PRE_RELEASE == 'false' - uses: peter-evans/enable-pull-request-automerge@v3 - with: - pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }} - token: ${{ secrets.GITHUB_TOKEN }} - merge-method: squash - - # Clean up the version bump branch after merge - - name: Delete Version Bump Branch - if: success() && env.IS_PRE_RELEASE == 'false' - run: | - git push origin --delete version-bump/${{ env.RELEASE_VERSION }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 9b97511..e5ad92f 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,7 @@ If you have the repo cloned locally, you can test run the CLI by running: # Publishing -Create a GitHub release with the version number you want to create. Make sure the tag you create matches the version number (e.g., `v1.2.3`) and release! GitHub actions will take over and attempt to publish the package version you specified. Note that a Pull request will get opened on the repo automatically to bump the package version to align with the latest release. This PR should be merged ASAP after opened to keep things in sync. +Create a GitHub release with the version number you want to create. Make sure the tag you create matches the version number (e.g., `v1.2.3`) and release! GitHub actions will take over and attempt to publish the package version you specified. --- From 511d1bdda25a3db0df98b237271873ee32067695 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 17:55:13 +0200 Subject: [PATCH 15/16] docs: readme tweaks --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e5ad92f..c9587f5 100644 --- a/README.md +++ b/README.md @@ -16,17 +16,17 @@ Furthermore, there are best practices we want to adhere to with our translated f Keeli will help you automatically discover many problems with your translation files, including: -✅ Finds untranslated messages -✅ Finds empty messages -✅ Finds missing variables -✅ Finds accidentally translated variables -✅ Finds variable syntax errors -✅ Finds missing keys -✅ Finds unknown/un-balanced keys -✅ Finds keys violating your naming convention -✅ Finds extra whitespace -✅ Finds HTML in messages -✅ _...and more!_ +- ✅ Finds untranslated messages +- ✅ Finds empty messages +- ✅ Finds missing variables +- ✅ Finds accidentally translated variables +- ✅ Finds variable syntax errors +- ✅ Finds missing keys +- ✅ Finds unknown/un-balanced keys +- ✅ Finds keys violating your naming convention +- ✅ Finds extra whitespace +- ✅ Finds HTML in messages +- ✅ _...and more!_ Most of these rules are configurable so you can customize keeli to your specific needs. From 8a45f6b0801051894d76644a2456a9c31aca9c6f Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 18:04:03 +0200 Subject: [PATCH 16/16] ci: dont create a version bump branch --- .github/workflows/release.yml | 9 --------- package.json | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e4f7297..7da10d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,12 +33,3 @@ jobs: run: npm publish --tag ${{ env.RELEASE_TAG }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Commit and push version bump - if: env.IS_PRE_RELEASE == 'false' - run: | - git checkout -b version-bump/${{ env.RELEASE_VERSION }} - git add package.json package-lock.json - git commit -m "chore: bump version to ${{ env.RELEASE_VERSION }}" - git push origin version-bump/${{ env.RELEASE_VERSION }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index a3cdc1a..90217c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "keeli", - "version": "0.0.1", + "version": "0.0.0", "main": "dist/index.js", "description": "Configurable CLI validation tool to check for common problems in your translated source files.", "author": {