Skip to content

Commit 8c6d6c6

Browse files
committed
merge
2 parents 487f931 + 0ff1a03 commit 8c6d6c6

5 files changed

Lines changed: 16777 additions & 53 deletions

File tree

.github/workflows/pre-prepare.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
name: Create release PR
22

3-
run-name: Create release PR for v${{ github.event.inputs.version }}
3+
run-name: Create release PR for new ${{ github.event.inputs.version }} version
44

55
on:
66
workflow_dispatch:
77
inputs:
88
version:
99
required: true
10-
description: "Version to bump `package.json` to (format: x.y.z)"
10+
type: choice
11+
description: "What type of release is this"
12+
options:
13+
- "major"
14+
- "minor"
15+
- "patch"
16+
update-language-server:
17+
required: true
18+
description: "Update the language server to the latest version?"
19+
type: boolean
20+
1121

1222
jobs:
1323
create-release-pr:
@@ -31,13 +41,29 @@ jobs:
3141
git config --global user.email "github-actions@github.com"
3242
git config --global user.name "GitHub Actions"
3343
34-
git checkout -b release/${{ inputs.version }}
44+
NEW_VERSION=$(./script/workflows/increment-version.sh ${{ inputs.version }})
45+
46+
git checkout -b release/$NEW_VERSION
3547
36-
npm version ${{ inputs.version }} --no-git-tag-version
48+
npm version $NEW_VERSION --no-git-tag-version
3749
git add package.json package-lock.json
38-
git commit -m "Release extension version ${{ inputs.version }}"
50+
git commit -m "Release extension version $NEW_VERSION"
51+
52+
git push --set-upstream origin release/$NEW_VERSION
53+
54+
echo "new_version=$NEW_VERSION" >> $GITHUB_ENV
55+
56+
- name: Update language server
57+
if: ${{ inputs.update-language-server }}
58+
run: |
59+
npm install @actions/languageserver@latest @actions/workflow-parser@latest --workspaces=false
60+
git checkout -- package.json
61+
npm i
3962
40-
git push --set-upstream origin release/${{ inputs.version }}
63+
- uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a
64+
with:
65+
branch: release/${{ env.new_version }}
66+
if: ${{ inputs.update-language-server }}
4167

4268
- name: Create PR
4369
run: |
@@ -47,6 +73,6 @@ jobs:
4773
--title "Release version ${{ env.new_version }}" \
4874
--body $RELEASE_NOTES \
4975
--base main \
50-
--head release/${{ inputs.version }}
76+
--head release/${{ env.new_version }}
5177
env:
5278
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

script/bootstrap

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ function clone_repo() {
1515
repo_root="$(git rev-parse --show-toplevel)"
1616
root="$(dirname "$repo_root")"
1717

18+
# Copy working package-lock.json to workspace
19+
echo "Copy lock file to workspace..."
20+
cp "$repo_root"/script/workspace/package-lock.json "$root"
21+
1822
# Clone dependent repos
1923
echo "Cloning dependent repos..."
2024
clone_repo https://github.com/actions/languageservices "$root"/languageservices
2125

22-
2326
# Copy workspace files
2427
echo "Copying workspace files..."
2528
cp "$repo_root"/script/workspace/package.json "$root"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
VERSION=$(cat package.json | jq -r '.version')
4+
5+
MAJOR=$(echo $VERSION | cut -d. -f1)
6+
MINOR=$(echo $VERSION | cut -d. -f2)
7+
PATCH=$(echo $VERSION | cut -d. -f3)
8+
9+
if [ "$1" == "major" ]; then
10+
MAJOR=$((MAJOR+1))
11+
MINOR=0
12+
PATCH=0
13+
elif [ "$1" == "minor" ]; then
14+
MINOR=$((MINOR+1))
15+
PATCH=0
16+
elif [ "$1" == "patch" ]; then
17+
PATCH=$((PATCH+1))
18+
else
19+
echo "Invalid version type. Use 'major', 'minor' or 'patch'"
20+
exit 1
21+
fi
22+
23+
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
24+
echo $NEW_VERSION

0 commit comments

Comments
 (0)