Skip to content

Commit

Permalink
feat: update GitHub Actions workflow to retrieve package version and …
Browse files Browse the repository at this point in the history
…create releases
  • Loading branch information
bucurdavid committed Feb 14, 2025
1 parent b05512b commit d556c5f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
32 changes: 15 additions & 17 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,28 @@ jobs:
pnpm run build:stable
fi
- name: Get Next Version
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Package Version
id: package_version
run: |
pnpm add -D semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/npm
OUTPUT=$(unset GITHUB_ACTIONS && npx semantic-release --dry-run --no-ci)
VERSION=$(echo "$OUTPUT" | grep -o "The next release version is [0-9]*\.[0-9]*\.[0-9]*" | awk '{print $6}')
VERSION=$(node -p "require('./package.json').version")
if [[ "${{ steps.release_type.outputs.type }}" == "alpha" ]]; then
VERSION="${VERSION}-alpha.$(date +%s)"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Update Version
run: |
npm version ${{ steps.semantic.outputs.version }} --no-git-tag-version
npm version ${{ steps.package_version.outputs.version }} --no-git-tag-version
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_TAG="v${{ steps.package_version.outputs.version }}"
gh release create $RELEASE_TAG \
--target=$GITHUB_SHA \
--title="$RELEASE_TAG" \
--generate-notes
- name: Publish
env:
Expand All @@ -88,12 +94,4 @@ jobs:
pnpm publish --access=public --tag alpha --no-git-checks
else
pnpm publish --access=public --no-git-checks
fi
- name: Create Git Tag
if: success()
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git tag -a "v${{ steps.semantic.outputs.version }}" -m "Release v${{ steps.semantic.outputs.version }}"
git push origin "v${{ steps.semantic.outputs.version }}"
fi
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aithranetwork/plugin-aithra-toolkit",
"version": "0.0.4",
"version": "0.0.5",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down

0 comments on commit d556c5f

Please sign in to comment.