Skip to content

Fix node.js.yml

Fix node.js.yml #12

Workflow file for this run

name: Build and Release Source Code
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
# Checkout the code
- uses: actions/checkout@v4
# Set up Node.js
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# Install dependencies
- run: npm ci
# Build the project
- run: npm run build --if-present
release:
runs-on: ubuntu-latest
needs: build
steps:
# Checkout the code
- uses: actions/checkout@v4
# Create a new Git tag
- name: Create Git Tag
id: tag
run: |
TAG_NAME=v1.${{ github.run_number }}
git tag $TAG_NAME
git push origin $TAG_NAME
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
# Get Changelog for the latest commit
- name: Get Changelog
id: changelog
run: echo "CHANGELOG=$(git log -1 --pretty=format:'%h - %s (%an, %ad)')" >> $GITHUB_ENV
# Create GitHub Release with source code only
- name: Create GitHub Release
uses: softprops/[email protected]
with:
tag_name: ${{ env.TAG_NAME }}
body: |
## Changelog
${{ env.CHANGELOG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}