From 95e991b10b80ec003bc577e429932f4eb3bf2efa Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 16 Jan 2025 13:49:28 -0700 Subject: [PATCH 01/15] chore: add release-please configuration --- .github/workflows/release-please.yml | 8 ++------ release-please-config.json | 13 +++++++++++++ release-please-manifest.json | 3 +++ 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 release-please-config.json create mode 100644 release-please-manifest.json diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index b9b8a8f86..695f6f939 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -15,10 +15,6 @@ jobs: steps: - uses: googleapis/release-please-action@v4 with: - # this assumes that you have created a personal access token - # (PAT) and configured it as a GitHub action secret named - # `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important). token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} - # this is a built-in strategy in release-please, see "Action Inputs" - # for more options - release-type: simple \ No newline at end of file + config-file: release-please-config.json + manifest-file: release-please-manifest.json \ No newline at end of file diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 000000000..ae6106a77 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,13 @@ +{ + "packages": { + ".": { + "release-type": "simple", + "changelog-path": "CHANGELOG.md", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "draft": false, + "prerelease": false + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} diff --git a/release-please-manifest.json b/release-please-manifest.json new file mode 100644 index 000000000..b985ff6e7 --- /dev/null +++ b/release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1" +} From 9732dfd6b76b0124d42c48f7656329046ea6930f Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 16 Jan 2025 14:05:23 -0700 Subject: [PATCH 02/15] fix(main): update release-please --- .github/workflows/release-please.yml | 18 +++++++++++++++++- release-please-manifest.json | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 695f6f939..e298aa7d0 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -14,7 +14,23 @@ jobs: runs-on: ubuntu-latest steps: - uses: googleapis/release-please-action@v4 + id: release with: token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} config-file: release-please-config.json - manifest-file: release-please-manifest.json \ No newline at end of file + manifest-file: release-please-manifest.json + skip-github-pull-request: true + + - uses: actions/checkout@v4 + if: ${{ steps.release.outputs.release_created }} + + - name: Update version and push + if: ${{ steps.release.outputs.release_created }} + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + git add . + git commit -m "chore: update version to ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}" + git push + env: + GITHUB_TOKEN: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} diff --git a/release-please-manifest.json b/release-please-manifest.json index b985ff6e7..40ff6fe0d 100644 --- a/release-please-manifest.json +++ b/release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.1" + ".": "0.0.2" } From 7c26d63929e78fa4714cdadbe1ef87bd94388ac5 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 16 Jan 2025 14:18:51 -0700 Subject: [PATCH 03/15] fix(main): this is a push to main to trigger a release --- .github/workflows/release-please.yml | 1 - .release-please-manifest.json | 3 +++ release-please-config.json | 5 +---- release-please-manifest.json | 3 --- version.txt | 2 -- 5 files changed, 4 insertions(+), 10 deletions(-) create mode 100644 .release-please-manifest.json delete mode 100644 release-please-manifest.json delete mode 100644 version.txt diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index e298aa7d0..97e8c00cd 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -18,7 +18,6 @@ jobs: with: token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} config-file: release-please-config.json - manifest-file: release-please-manifest.json skip-github-pull-request: true - uses: actions/checkout@v4 diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 000000000..b985ff6e7 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1" +} diff --git a/release-please-config.json b/release-please-config.json index ae6106a77..b7d7be878 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -3,10 +3,7 @@ ".": { "release-type": "simple", "changelog-path": "CHANGELOG.md", - "bump-minor-pre-major": true, - "bump-patch-for-minor-pre-major": true, - "draft": false, - "prerelease": false + "prerelease": true } }, "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" diff --git a/release-please-manifest.json b/release-please-manifest.json deleted file mode 100644 index 40ff6fe0d..000000000 --- a/release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "0.0.2" -} diff --git a/version.txt b/version.txt deleted file mode 100644 index a4bdda4ce..000000000 --- a/version.txt +++ /dev/null @@ -1,2 +0,0 @@ -buster=0.0.1 -.=0.0.1 \ No newline at end of file From 20ba771a8d5f7b7b8d3286da24bd8938c2db7837 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 16 Jan 2025 14:25:24 -0700 Subject: [PATCH 04/15] fix: update README --- .github/workflows/release-please.yml | 4 +++- release-please-config.json => .release-please-config.json | 0 .release-please-manifest.json | 3 --- README.md | 2 +- version.txt | 1 + 5 files changed, 5 insertions(+), 5 deletions(-) rename release-please-config.json => .release-please-config.json (100%) delete mode 100644 .release-please-manifest.json create mode 100644 version.txt diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 97e8c00cd..0d1792b07 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -17,8 +17,10 @@ jobs: id: release with: token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} - config-file: release-please-config.json skip-github-pull-request: true + release-type: simple + prerelease: true + version-file: version.txt - uses: actions/checkout@v4 if: ${{ steps.release.outputs.release_created }} diff --git a/release-please-config.json b/.release-please-config.json similarity index 100% rename from release-please-config.json rename to .release-please-config.json diff --git a/.release-please-manifest.json b/.release-please-manifest.json deleted file mode 100644 index b985ff6e7..000000000 --- a/.release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "0.0.1" -} diff --git a/README.md b/README.md index fccd5c4fc..352ae38ef 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@
- MIT License + MIT License Y Combinator W24
diff --git a/version.txt b/version.txt new file mode 100644 index 000000000..8a9ecc2ea --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.0.1 \ No newline at end of file From 8a3a36e63bd3771cd005a64885ec101c00b9f642 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 16 Jan 2025 14:48:17 -0700 Subject: [PATCH 05/15] fix: use a node pipeline --- .github/workflows/release-please.yml | 71 +++++++++++++++++++--------- 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 0d1792b07..4553dbbd2 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -1,37 +1,64 @@ +name: Update Version + on: push: branches: - main +# Add permissions configuration permissions: contents: write pull-requests: write -name: release-please - jobs: - release-please: + version-bump: runs-on: ubuntu-latest + steps: - - uses: googleapis/release-please-action@v4 - id: release + # Step 1: Check out the repository + - name: Checkout Code + uses: actions/checkout@v4 with: token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} - skip-github-pull-request: true - release-type: simple - prerelease: true - version-file: version.txt - - - uses: actions/checkout@v4 - if: ${{ steps.release.outputs.release_created }} - - - name: Update version and push - if: ${{ steps.release.outputs.release_created }} + + # Step 2: Set up Node.js + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + # Step 3: Install Dependencies + - name: Install Dependencies + run: npm install standard-version --save-dev + + # Step 4: Determine New Version + - name: Determine Version + id: get_version run: | - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - git add . - git commit -m "chore: update version to ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}" - git push - env: - GITHUB_TOKEN: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} + # Read the current version + CURRENT_VERSION=$(cat version.txt) + echo "Current Version: $CURRENT_VERSION" + + # Get the next version using standard-version + NEW_VERSION=$(npx standard-version --dry-run | grep "tagging release" | awk '{print $NF}') + echo "New Version: $NEW_VERSION" + + # Export both versions for later steps + echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + + # Step 5: Update version.txt if version changes + - name: Update version.txt + if: env.CURRENT_VERSION != env.NEW_VERSION # Run only if the versions are different + run: | + echo "$NEW_VERSION" > version.txt + + # Step 6: Commit and Push Changes + - name: Commit and Push Changes + if: env.CURRENT_VERSION != env.NEW_VERSION # Run only if the versions are different + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add version.txt + git commit -m "chore(release): update version to $NEW_VERSION" + git push "https://${{ github.actor }}:${{ secrets.MY_RELEASE_PLEASE_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:main \ No newline at end of file From 75841b1c73bd03c2e26ebd83946934b50fb642a4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Jan 2025 21:50:46 +0000 Subject: [PATCH 06/15] chore(release): update version to --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 8a9ecc2ea..8b1378917 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.1 \ No newline at end of file + From 6a67afe5cbfc7581b0f340a92831b371278aa72c Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 16 Jan 2025 14:48:17 -0700 Subject: [PATCH 07/15] fix: use a node pipeline --- .github/workflows/release-please.yml | 83 ++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 0d1792b07..7da0ba582 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -1,37 +1,76 @@ +name: Update Version + on: push: branches: - main +# Add permissions configuration permissions: contents: write pull-requests: write -name: release-please - jobs: - release-please: + version-bump: runs-on: ubuntu-latest + steps: - - uses: googleapis/release-please-action@v4 - id: release + # Step 1: Check out the repository + - name: Checkout Code + uses: actions/checkout@v4 with: + fetch-depth: 0 # Fetch all history token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} - skip-github-pull-request: true - release-type: simple - prerelease: true - version-file: version.txt - - - uses: actions/checkout@v4 - if: ${{ steps.release.outputs.release_created }} - - - name: Update version and push - if: ${{ steps.release.outputs.release_created }} + + # Step 2: Set up Node.js + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + # Step 3: Install Dependencies + - name: Install Dependencies + run: npm install standard-version --save-dev + + # Step 4: Determine New Version + - name: Determine Version + id: get_version run: | - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - git add . - git commit -m "chore: update version to ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}" - git push - env: - GITHUB_TOKEN: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} + # Debug: List directory contents + echo "Listing directory contents:" + ls -la + + # Debug: Check if version.txt exists + if [ -f "version.txt" ]; then + echo "version.txt exists" + else + echo "version.txt does not exist" + fi + + # Read the current version + CURRENT_VERSION=$(cat version.txt) + echo "Current Version: $CURRENT_VERSION" + + # Get the next version using standard-version + NEW_VERSION=$(npx standard-version --dry-run | grep "tagging release" | awk '{print $NF}') + echo "New Version: $NEW_VERSION" + + # Export both versions for later steps + echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + + # Step 5: Update version.txt if version changes + - name: Update version.txt + if: env.CURRENT_VERSION != env.NEW_VERSION # Run only if the versions are different + run: | + echo "$NEW_VERSION" > version.txt + + # Step 6: Commit and Push Changes + - name: Commit and Push Changes + if: env.CURRENT_VERSION != env.NEW_VERSION # Run only if the versions are different + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add version.txt + git commit -m "chore(release): update version to $NEW_VERSION" + git push "https://${{ github.actor }}:${{ secrets.MY_RELEASE_PLEASE_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:main \ No newline at end of file From d6e6f41165385f00808ec7a1f0214c65f88d4f3c Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 16 Jan 2025 14:54:51 -0700 Subject: [PATCH 08/15] fix: update the prerelease logic --- .github/workflows/release-please.yml | 7 ++++--- version.txt | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 7da0ba582..ed6986c2b 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -43,6 +43,8 @@ jobs: # Debug: Check if version.txt exists if [ -f "version.txt" ]; then echo "version.txt exists" + echo "Current content of version.txt:" + cat version.txt else echo "version.txt does not exist" fi @@ -58,16 +60,15 @@ jobs: # Export both versions for later steps echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - # Step 5: Update version.txt if version changes - name: Update version.txt - if: env.CURRENT_VERSION != env.NEW_VERSION # Run only if the versions are different + if: env.CURRENT_VERSION && env.CURRENT_VERSION != env.NEW_VERSION # Run only if version exists and versions are different run: | echo "$NEW_VERSION" > version.txt # Step 6: Commit and Push Changes - name: Commit and Push Changes - if: env.CURRENT_VERSION != env.NEW_VERSION # Run only if the versions are different + if: env.CURRENT_VERSION && env.CURRENT_VERSION != env.NEW_VERSION # Run only if version exists and versions are different run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" diff --git a/version.txt b/version.txt index 8b1378917..8acdd82b7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ - +0.0.1 From 7cf0645ce98e0871a3fbd2fcd86992cc04df57af Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Jan 2025 21:58:51 +0000 Subject: [PATCH 09/15] chore(release): update version to --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 8acdd82b7..8b1378917 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.1 + From 3016e16afbcd3199965e6d1395a360d7ff8652d0 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 16 Jan 2025 14:54:51 -0700 Subject: [PATCH 10/15] fix: update the prerelease logic --- .github/workflows/release-please.yml | 50 +++++++++++----------------- version.txt | 2 +- 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 7da0ba582..c84584472 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -22,52 +22,42 @@ jobs: fetch-depth: 0 # Fetch all history token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} - # Step 2: Set up Node.js - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '20' - - # Step 3: Install Dependencies - - name: Install Dependencies - run: npm install standard-version --save-dev - - # Step 4: Determine New Version + # Step 2: Determine Version - name: Determine Version id: get_version run: | - # Debug: List directory contents - echo "Listing directory contents:" - ls -la - - # Debug: Check if version.txt exists - if [ -f "version.txt" ]; then - echo "version.txt exists" - else - echo "version.txt does not exist" + if [ ! -f "version.txt" ]; then + echo "0.0.1" > version.txt fi - # Read the current version CURRENT_VERSION=$(cat version.txt) echo "Current Version: $CURRENT_VERSION" - - # Get the next version using standard-version - NEW_VERSION=$(npx standard-version --dry-run | grep "tagging release" | awk '{print $NF}') + + # Split version into components + IFS='.' read -r -a version_parts <<< "$CURRENT_VERSION" + MAJOR="${version_parts[0]}" + MINOR="${version_parts[1]}" + PATCH="${version_parts[2]}" + + # Increment patch version + NEW_PATCH=$((PATCH + 1)) + NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH" + echo "New Version: $NEW_VERSION" - - # Export both versions for later steps + + # Export versions for later steps echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - # Step 5: Update version.txt if version changes + # Step 3: Update version.txt if version changes - name: Update version.txt - if: env.CURRENT_VERSION != env.NEW_VERSION # Run only if the versions are different + if: env.CURRENT_VERSION != env.NEW_VERSION run: | echo "$NEW_VERSION" > version.txt - # Step 6: Commit and Push Changes + # Step 4: Commit and Push Changes - name: Commit and Push Changes - if: env.CURRENT_VERSION != env.NEW_VERSION # Run only if the versions are different + if: env.CURRENT_VERSION != env.NEW_VERSION run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" diff --git a/version.txt b/version.txt index 8b1378917..8acdd82b7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ - +0.0.1 From e31f702c281c6a5249500e6aac585f2f99129e6d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Jan 2025 22:06:06 +0000 Subject: [PATCH 11/15] chore(release): update version to 0.0.2 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 8acdd82b7..4e379d2bf 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.1 +0.0.2 From 7caaa97f171b15c314e8db3e49edbac9113d2707 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Jan 2025 22:06:18 +0000 Subject: [PATCH 12/15] chore(release): update version to 0.0.3 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 4e379d2bf..bcab45af1 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.2 +0.0.3 From df8940fd0b85b370c8294dd1ebba83e1b19d90e5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Jan 2025 22:06:29 +0000 Subject: [PATCH 13/15] chore(release): update version to 0.0.4 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index bcab45af1..81340c7e7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.3 +0.0.4 From 928d1c34af94f0008b0aaf62527b32c4a1ce4b5d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Jan 2025 22:06:40 +0000 Subject: [PATCH 14/15] chore(release): update version to 0.0.5 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 81340c7e7..bbdeab622 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.4 +0.0.5 From 5b0e22173851fe7df4e81afc5bea811ae1f01fc1 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 16 Jan 2025 15:08:47 -0700 Subject: [PATCH 15/15] fix: stablize versioning --- .github/workflows/release-please.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index c84584472..60759225a 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -13,6 +13,9 @@ permissions: jobs: version-bump: runs-on: ubuntu-latest + + # Add condition to skip if last commit was a release + if: "!startsWith(github.event.head_commit.message, 'chore(release)')" steps: # Step 1: Check out the repository