Skip to content

Commit 980556b

Browse files
fix version
1 parent 7513e48 commit 980556b

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Set Version from Branch'
2+
description: 'Sets VERSION environment variable from the current branch name'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Set version from branch name
8+
shell: bash
9+
run: |
10+
# Use GITHUB_HEAD_REF for PRs, GITHUB_REF_NAME for direct pushes
11+
if [ -n "$GITHUB_HEAD_REF" ]; then
12+
BRANCH_NAME="$GITHUB_HEAD_REF"
13+
else
14+
BRANCH_NAME="$GITHUB_REF_NAME"
15+
fi
16+
echo "VERSION=$BRANCH_NAME" >> $GITHUB_ENV
17+
echo "Using version: $BRANCH_NAME"

.github/workflows/build.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ jobs:
6767
run: npm ci
6868

6969
- name: Set version from branch name
70-
run: |
71-
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
72-
echo "VERSION=$BRANCH_NAME" >> $GITHUB_ENV
73-
echo "Using version: $BRANCH_NAME"
70+
uses: ./.github/actions/set-version
7471

7572
- name: Build VSIX package
7673
run: make vsix

.github/workflows/publish-ovsx.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
name: Publish to Open VSX
22

33
on:
4+
push:
45
workflow_dispatch:
5-
inputs:
6-
version:
7-
description: 'Version to publish (must match a build artifact)'
8-
required: true
9-
type: string
106

117
permissions:
128
contents: read
@@ -28,13 +24,15 @@ jobs:
2824
- name: Install dependencies
2925
run: npm ci
3026

27+
- name: Set version from branch name
28+
uses: ./.github/actions/set-version
29+
3130
- name: Download VSIX artifact
3231
uses: actions/download-artifact@v4
3332
with:
34-
name: vsix-${{ inputs.version }}
33+
name: vsix-${{ env.VERSION }}
3534

3635
- name: Publish to Open VSX
3736
run: make publish-ovsx
3837
env:
39-
VERSION: ${{ inputs.version }}
4038
OVSX_PAT: ${{ secrets.OVSX_PAT }}

.github/workflows/publish-vs-marketplace.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
name: Publish to Visual Studio Marketplace
22

33
on:
4+
push:
45
workflow_dispatch:
5-
inputs:
6-
version:
7-
description: 'Version to publish (must match a build artifact)'
8-
required: true
9-
type: string
106

117
permissions:
128
contents: read
@@ -28,13 +24,15 @@ jobs:
2824
- name: Install dependencies
2925
run: npm ci
3026

27+
- name: Set version from branch name
28+
uses: ./.github/actions/set-version
29+
3130
- name: Download VSIX artifact
3231
uses: actions/download-artifact@v4
3332
with:
34-
name: vsix-${{ inputs.version }}
33+
name: vsix-${{ env.VERSION }}
3534

3635
- name: Publish to VS Marketplace
3736
run: make publish-marketplace
3837
env:
39-
VERSION: ${{ inputs.version }}
4038
VSCE_PAT: ${{ secrets.VSCE_PAT }}

0 commit comments

Comments
 (0)