Create Release #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Release | |
on: | |
workflow_dispatch: # Trigger manually | |
jobs: | |
release: | |
name: Create and Upload Release | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
# Step 2: Set up Node.js | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' # Use the latest LTS version | |
# Step 3: Install dependencies | |
- name: Install Dependencies | |
run: npm install | |
# Step 4: Build the package | |
- name: Build Package | |
run: npm run build | |
# Step 5: Get version and name from package.json | |
- name: Read package.json | |
id: package_info | |
run: | | |
echo "name=$(jq -r '.name' package.json)" >> $GITHUB_ENV | |
echo "version=$(jq -r '.version' package.json)" >> $GITHUB_ENV | |
# Step 6: Create the GitHub Release | |
- name: Create GitHub Release | |
id: create_release | |
uses: comnoco/create-release-action@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.version }} | |
release_name: ${{ env.name }} v${{ env.version }} | |
body: | | |
## Release Notes | |
- Version: ${{ env.version }} | |
- Library: ${{ env.name }} | |
draft: false | |
prerelease: false | |
# Step 7: Upload artifacts to the release | |
- name: Upload dist folder to Release | |
uses: AButler/[email protected] | |
with: | |
files: "./dist/*" # Matches all files in the dist folder | |
repo-token: ${{ secrets.GITHUB_TOKEN }} |