From 8e3dc658a05f531b36fbfcd3c877ee78a8709de3 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Mon, 9 Sep 2024 09:59:13 -0400 Subject: [PATCH 1/3] ci: fix release script --- scripts/release.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/release.sh b/scripts/release.sh index fd428cc..3f73719 100644 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -20,6 +20,7 @@ git checkout -b "$FEATURE_BRANCH" # Commit changes git add . git commit -m "chore(release): bump version to $NEW_VERSION" +git push --set-upstream origin $FEATURE_BRANCH # Notify the user about the feature branch echo "Version bumped and committed on branch $FEATURE_BRANCH." From 2e0d46c95100ab37617d53d49084a4166c26158f Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Mon, 9 Sep 2024 09:59:30 -0400 Subject: [PATCH 2/3] ci: fix release script --- .../workflows/ensure-version-increment.yaml | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ensure-version-increment.yaml b/.github/workflows/ensure-version-increment.yaml index d22bc6f..4999d77 100644 --- a/.github/workflows/ensure-version-increment.yaml +++ b/.github/workflows/ensure-version-increment.yaml @@ -1,48 +1,47 @@ -name: Auto Tag +# This workflow runs on any PRs that are targeting main and ensures that the version in package.json is incremented +name: Check Version Increment on: - push: + pull_request: branches: - - main + - 'main' concurrency: - group: main-release-check + # SHA is added to the end if on `main` to let all main workflows run + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }} + cancel-in-progress: true jobs: - release: - name: release + check-version: + name: Check version increment runs-on: ubuntu-latest steps: - - name: Clean workspace - uses: Chia-Network/actions/clean-workspace@main + - uses: Chia-Network/actions/clean-workspace@main - name: Checkout current branch uses: actions/checkout@v3 with: - # Need PACKAGE_ADMIN_PAT token so when the tag is created, the tag automation runs - token: ${{ secrets.GH_ACCESS_TOKEN }} - fetch-depth: 0 + path: branch-repo - - name: Set Git identity - run: | - git config --local user.email "automation@michaeltaylor.dev" - git config --local user.name "Automation" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout main + uses: actions/checkout@v3 + with: + ref: main + path: main-repo - - name: Extract version from package.json + - name: Check Versions run: | - VERSION=$(jq -r '.version' package.json) - echo "Extracted version: $VERSION" - - # Set the version as an output for other steps to use - echo "VERSION=$VERSION" >> $GITHUB_ENV + # Extract version from main branch's package.json + mainVersion=$(jq -r '.version' main-repo/package.json) + echo "Main version: $mainVersion" - if git tag --list | grep -q "^$VERSION$"; then - echo "Tag $VERSION already exists, nothing to do." - else - echo "Tag does not exist. Creating and pushing tag." - git tag $VERSION -m "Release $VERSION" - git push origin $VERSION + # Extract version from current branch's package.json + branchVersion=$(jq -r '.version' branch-repo/package.json) + echo "Branch version: $branchVersion" + + # Compare versions + if [ "$branchVersion" == "$mainVersion" ]; then + echo "Version in package.json on this branch is not incremented. Version must increment for a merge to main." + exit 1 fi shell: bash From 15accf7f6c45f57b3b35074745777bdcf6ad2c24 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Mon, 9 Sep 2024 09:59:49 -0400 Subject: [PATCH 3/3] chore(release): 0.0.1-alpha.5 --- CHANGELOG.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f58bc24..842c33e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.1-alpha.5](https://github.com/DIG-Network/dig-content-server/compare/v0.0.1-alpha.4...v0.0.1-alpha.5) (2024-09-09) + ### [0.0.1-alpha.4](https://github.com/DIG-Network/dig-content-server/compare/v0.0.1-alpha.3...v0.0.1-alpha.4) (2024-09-09) ### [0.0.1-alpha.3](https://github.com/DIG-Network/dig-content-server/compare/v0.0.1...v0.0.1-alpha.3) (2024-09-09) diff --git a/package-lock.json b/package-lock.json index 54b8896..0451ee6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dig-cli", - "version": "0.0.1-alpha.4", + "version": "0.0.1-alpha.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dig-cli", - "version": "0.0.1-alpha.4", + "version": "0.0.1-alpha.5", "license": "ISC", "dependencies": { "async-mutex": "^0.5.0", diff --git a/package.json b/package.json index 1a228d2..a7d5457 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dig-cli", - "version": "0.0.1-alpha.4", + "version": "0.0.1-alpha.5", "description": "", "type": "commonjs", "main": "./dist/index.js",