Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneyEagle committed Jan 5, 2025
2 parents 088cbe9 + 2ef2ceb commit d5a4baa
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ name: Node.js Package
on:
release:
types: [created]

workflow_dispatch:
workflow_run:
workflows: release

jobs:
build:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Create Release

on:
push:
workflow_dispatch:

jobs:
create-release:
runs-on: ubuntu-latest

steps:
# Step 1: Check out the code
- name: Checkout code
uses: actions/checkout@v4

# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16' # Use the latest LTS version of Node.js

# Step 3: Read the version from package.json
- name: Get version from package.json
id: get_version
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
# Step 4: Create the tag
- name: Create tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${PACKAGE_VERSION}" -m "Release ${PACKAGE_VERSION}"
git push origin "${PACKAGE_VERSION}"
# Step 5: Create GitHub release
- name: Create GitHub Release
uses: actions/create-release@v1
with:
tag_name: "${{ env.PACKAGE_VERSION }}"
release_name: "Release ${{ env.PACKAGE_VERSION }}"
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit d5a4baa

Please sign in to comment.