Update node.js.yml #11
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Electron Workflow | |
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 "::set-output name=TAG_NAME::$TAG_NAME" | |
# Create GitHub Release with the new tag | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.tag.outputs.TAG_NAME }} | |
files: | | |
**/*.js | |
**/*.json | |
**/*.html | |
**/*.css | |
body: | | |
## Changelog | |
$(git log -1 --pretty=format:"%h - %s (%an, %ad)") | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |