Skip to content

Commit b220fc4

Browse files
committed
publish pipeline changes
1 parent e25c96c commit b220fc4

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,6 @@ jobs:
3030
TAG_VERSION=${GITHUB_REF#refs/tags/v}
3131
echo "version=$TAG_VERSION" >> $GITHUB_OUTPUT
3232
33-
- name: Determine source branch
34-
id: branch
35-
run: |
36-
TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref }})
37-
git fetch --all
38-
SOURCE_BRANCH=$(git branch -r --contains $TAG_COMMIT | sed -E 's|^.*origin/([^ ]+).*$|\1|' | head -1)
39-
40-
if [ -z "$SOURCE_BRANCH" ]; then
41-
echo "Error: Could not determine source branch for tag ${{ github.ref }}"
42-
exit 1
43-
fi
44-
echo "Source branch: $SOURCE_BRANCH"
45-
echo "source_branch=$SOURCE_BRANCH" >> $GITHUB_OUTPUT
46-
4733
- name: Check if version needs to be updated
4834
id: check_version
4935
run: |
@@ -64,14 +50,14 @@ jobs:
6450
npm version ${{ steps.version.outputs.version }} --no-git-tag-version
6551
git config --global user.name "GitHub Actions"
6652
git config --global user.email "[email protected]"
67-
git fetch origin ${{ steps.branch.outputs.source_branch }}
68-
git pull origin ${{ steps.branch.outputs.source_branch }} --rebase
53+
git fetch origin ${{ github.ref_name }}
54+
git pull origin ${{ github.ref_name }} --rebase
6955
git add package.json package-lock.json
7056
git commit -m "Bump version to ${{ steps.version.outputs.version }} [skip ci]"
71-
git push origin HEAD:${{ steps.branch.outputs.source_branch }}
57+
git push origin HEAD:${{ github.ref_name }}
7258
7359
- name: Rename tag for develop branch
74-
if: steps.branch.outputs.source_branch == 'develop'
60+
if: github.ref_name == 'develop'
7561
run: |
7662
TIMESTAMP=$(date -u +"%Y%m%d%H%M%S")
7763
NEW_TAG="v${{ steps.version.outputs.version }}-dev$TIMESTAMP"
@@ -123,8 +109,8 @@ jobs:
123109
runs-on: ubuntu-latest
124110
needs: [build]
125111
if: |
126-
needs.version.outputs.source_branch == 'master' ||
127-
needs.version.outputs.source_branch == 'develop'
112+
github.ref_name == 'master' ||
113+
github.ref_name == 'develop'
128114
129115
steps:
130116
- name: Download package files
@@ -153,7 +139,7 @@ jobs:
153139

154140
- name: Publish to npm
155141
run: |
156-
if [ "${{ needs.version.outputs.source_branch }}" == "develop" ]; then
142+
if [ "${{ github.ref_name }}" == "develop" ]; then
157143
npm publish --tag dev
158144
else
159145
npm publish

0 commit comments

Comments
 (0)