Skip to content

Commit d556c5f

Browse files
committed
feat: update GitHub Actions workflow to retrieve package version and create releases
1 parent b05512b commit d556c5f

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,28 @@ jobs:
6363
pnpm run build:stable
6464
fi
6565
66-
- name: Get Next Version
67-
id: semantic
68-
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
- name: Get Package Version
67+
id: package_version
7068
run: |
71-
pnpm add -D semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/npm
72-
OUTPUT=$(unset GITHUB_ACTIONS && npx semantic-release --dry-run --no-ci)
73-
VERSION=$(echo "$OUTPUT" | grep -o "The next release version is [0-9]*\.[0-9]*\.[0-9]*" | awk '{print $6}')
69+
VERSION=$(node -p "require('./package.json').version")
7470
if [[ "${{ steps.release_type.outputs.type }}" == "alpha" ]]; then
7571
VERSION="${VERSION}-alpha.$(date +%s)"
7672
fi
7773
echo "version=${VERSION}" >> $GITHUB_OUTPUT
7874
7975
- name: Update Version
8076
run: |
81-
npm version ${{ steps.semantic.outputs.version }} --no-git-tag-version
77+
npm version ${{ steps.package_version.outputs.version }} --no-git-tag-version
78+
79+
- name: Create Release
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
run: |
83+
RELEASE_TAG="v${{ steps.package_version.outputs.version }}"
84+
gh release create $RELEASE_TAG \
85+
--target=$GITHUB_SHA \
86+
--title="$RELEASE_TAG" \
87+
--generate-notes
8288
8389
- name: Publish
8490
env:
@@ -88,12 +94,4 @@ jobs:
8894
pnpm publish --access=public --tag alpha --no-git-checks
8995
else
9096
pnpm publish --access=public --no-git-checks
91-
fi
92-
93-
- name: Create Git Tag
94-
if: success()
95-
run: |
96-
git config user.name 'github-actions[bot]'
97-
git config user.email 'github-actions[bot]@users.noreply.github.com'
98-
git tag -a "v${{ steps.semantic.outputs.version }}" -m "Release v${{ steps.semantic.outputs.version }}"
99-
git push origin "v${{ steps.semantic.outputs.version }}"
97+
fi

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aithranetwork/plugin-aithra-toolkit",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"type": "module",
55
"main": "dist/index.js",
66
"module": "dist/index.js",

0 commit comments

Comments
 (0)