From 97b4179dae0a3e93369739ceadf8637ea6b4bc4a Mon Sep 17 00:00:00 2001 From: Felipe Suero Date: Thu, 27 Apr 2023 10:10:18 -0400 Subject: [PATCH 1/6] increment version numbers using bash script --- .github/workflows/release.yml | 25 +++++++++++++++++-------- script/workflows/increment-version.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 8 deletions(-) create mode 100755 script/workflows/increment-version.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index feb08423..3385b645 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,12 @@ on: inputs: version: required: true - description: "Version to bump `package.json` to (format: x.y.z)" + type: choice + description: "What type of release is this" + options: + - "major" + - "minor" + - "patch" jobs: create-release-pr: @@ -31,20 +36,24 @@ jobs: git config --global user.email "github-actions@github.com" git config --global user.name "GitHub Actions" - git checkout -b release/${{ inputs.version }} + NEW_VERSION=$(./scripts/workflows/increment-version.sh ${{ inputs.version }}) - npm version ${{ inputs.version }} --no-git-tag-version + git checkout -b release/$NEW_VERSION + + npm version $NEW_VERSION --no-git-tag-version git add package.json package-lock.json - git commit -m "Release extension version ${{ inputs.version }}" + git commit -m "Release extension version $NEW_VERSION" + + git push --set-upstream origin release/$NEW_VERSION - git push --set-upstream origin release/${{ inputs.version }} + echo "new_version=$NEW_VERSION" >> $GITHUB_ENV - name: Create PR run: | gh pr create \ - --title "Release version ${{ inputs.version }}" \ - --body "Release version ${{ inputs.version }}" \ + --title "Release version ${{ env.new_version }}" \ + --body "Release version ${{ env.new_version }}" \ --base main \ - --head release/${{ inputs.version }} + --head release/${{ env.new_version }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/script/workflows/increment-version.sh b/script/workflows/increment-version.sh new file mode 100755 index 00000000..fe95efc1 --- /dev/null +++ b/script/workflows/increment-version.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +VERSION=$(cat package.json | jq -r '.version') + +echo "Current version: $VERSION" +echo "Incrementing $1 version" + +MAJOR=$(echo $VERSION | cut -d. -f1) +MINOR=$(echo $VERSION | cut -d. -f2) +PATCH=$(echo $VERSION | cut -d. -f3) + +if [ "$1" == "major" ]; then + MAJOR=$((MAJOR+1)) + MINOR=0 + PATCH=0 +elif [ "$1" == "minor" ]; then + MINOR=$((MINOR+1)) + PATCH=0 +elif [ "$1" == "patch" ]; then + PATCH=$((PATCH+1)) +else + echo "Invalid version type. Use 'major', 'minor' or 'patch'" + exit 1 +fi + +NEW_VERSION="$MAJOR.$MINOR.$PATCH" +echo $NEW_VERSION From e659c7b4081ab49fcbfdfeb678eb4925f7b81507 Mon Sep 17 00:00:00 2001 From: Felipe Suero Date: Thu, 27 Apr 2023 10:19:17 -0400 Subject: [PATCH 2/6] Reword title --- .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 3385b645..7918288f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ name: Create release PR -run-name: Create release PR for v${{ github.event.inputs.version }} +run-name: Create release PR for new v${{ github.event.inputs.version }} version on: workflow_dispatch: From 45274bec261b961899fa47b0a991472e87a42a5f Mon Sep 17 00:00:00 2001 From: Felipe Suero Date: Fri, 28 Apr 2023 12:40:25 -0400 Subject: [PATCH 3/6] fix typo --- .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 c23038ce..5f0a572d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ name: Create release PR -run-name: Create release PR for new v${{ github.event.inputs.version }} version +run-name: Create release PR for new ${{ github.event.inputs.version }} version on: workflow_dispatch: From 90f371cc54a5f01d49d3e026cdf23a6c5214dfd8 Mon Sep 17 00:00:00 2001 From: Felipe Suero Date: Fri, 28 Apr 2023 12:41:13 -0400 Subject: [PATCH 4/6] fix typo2 --- .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 5f0a572d..80cb15b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: git config --global user.email "github-actions@github.com" git config --global user.name "GitHub Actions" - NEW_VERSION=$(./scripts/workflows/increment-version.sh ${{ inputs.version }}) + NEW_VERSION=$(./script/workflows/increment-version.sh ${{ inputs.version }}) git checkout -b release/$NEW_VERSION From 911f57f64eb61f29182f976ddc553db2b392fd4c Mon Sep 17 00:00:00 2001 From: Felipe Suero Date: Fri, 28 Apr 2023 12:44:12 -0400 Subject: [PATCH 5/6] remove redundant echo --- script/workflows/increment-version.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/script/workflows/increment-version.sh b/script/workflows/increment-version.sh index fe95efc1..5f00aa22 100755 --- a/script/workflows/increment-version.sh +++ b/script/workflows/increment-version.sh @@ -2,9 +2,6 @@ VERSION=$(cat package.json | jq -r '.version') -echo "Current version: $VERSION" -echo "Incrementing $1 version" - MAJOR=$(echo $VERSION | cut -d. -f1) MINOR=$(echo $VERSION | cut -d. -f2) PATCH=$(echo $VERSION | cut -d. -f3) From ee7acd91e3ae29cd2304907b4c76595b050359b0 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Fri, 28 Apr 2023 16:45:02 +0000 Subject: [PATCH 6/6] Release extension version 0.25.7 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 122d2b60..ff8a889a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-github-actions", - "version": "0.25.6", + "version": "0.25.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vscode-github-actions", - "version": "0.25.6", + "version": "0.25.7", "license": "MIT", "dependencies": { "@actions/languageserver": "*", diff --git a/package.json b/package.json index 935d3f16..9d32daf0 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/github/vscode-github-actions" }, "description": "GitHub Actions workflows and runs for github.com hosted repositories in VS Code", - "version": "0.25.6", + "version": "0.25.7", "engines": { "vscode": "^1.72.0", "node": ">= 16"