File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 release :
55 types : [released, edited]
66
7+ permissions :
8+ contents : write
9+
710jobs :
811 sync-version :
912 runs-on : ubuntu-latest
1013
11- permissions :
12- contents : write
13-
1414 steps :
1515 - name : Checkout repository
1616 uses : actions/checkout@v4
17+ with :
18+ fetch-depth : 0 # required so we can switch branches
19+
20+ - name : Detect default branch
21+ id : branch
22+ run : |
23+ DEFAULT_BRANCH=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
24+ echo "branch=$DEFAULT_BRANCH" >> $GITHUB_OUTPUT
25+
26+ - name : Switch to default branch
27+ run : |
28+ git checkout "${{ steps.branch.outputs.branch }}"
1729
1830 - name : Extract release tag
1931 run : echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
2032
2133 - name : Update package.json version
2234 run : |
23- TAG="${RELEASE_TAG#v}" # remove leading "v"
35+ TAG="${RELEASE_TAG#v}"
2436 echo "Updating version to $TAG"
2537 jq ".version = \"$TAG\"" package.json > package.tmp.json
2638 mv package.tmp.json package.json
2941 run : |
3042 git config user.name "vTagBot"
3143 git config user.email "actions@github.com"
44+
3245 git add package.json
3346 git commit -m "chore: sync version to $RELEASE_TAG" || echo "No changes to commit"
34- git push
47+
48+ git push origin "${{ steps.branch.outputs.branch }}"
You can’t perform that action at this time.
0 commit comments