2024-05-11 07:03:56 +08:00
# 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 : Node.js CI
on :
push :
2024-05-11 10:18:25 +08:00
branches : [ "master" ]
2024-05-11 09:53:14 +08:00
paths : [ "version" ]
2024-05-11 07:03:56 +08:00
jobs :
build :
runs-on : ubuntu-latest
strategy :
matrix :
2024-05-11 08:07:20 +08:00
node-version : [ 20. x]
2024-05-11 07:03:56 +08:00
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps :
- uses : actions/checkout@v4
2024-05-11 09:53:14 +08:00
- name : version
id : version
run : |
2024-05-11 09:59:04 +08:00
version=$(cat version)
2024-05-11 09:53:14 +08:00
echo "version=$version" >> $GITHUB_ENV
2024-05-11 07:03:56 +08:00
- name : Use Node.js ${{ matrix.node-version }}
2024-05-11 08:07:20 +08:00
uses : actions/setup-node@v4
2024-05-11 07:03:56 +08:00
with :
node-version : ${{ matrix.node-version }}
cache : 'npm'
2024-05-11 07:07:41 +08:00
- name : Install dependencies
2024-05-11 07:08:21 +08:00
run : npm install
2024-05-11 09:27:49 +08:00
# Actions构建
2024-05-11 07:18:27 +08:00
- name : Build
2024-05-11 09:53:14 +08:00
run : npm run actions --tag=${{ env.version }}
2024-05-11 10:15:05 +08:00
- name : Create Release
id : create_release
uses : actions/create-release@latest
env :
2024-05-11 10:18:25 +08:00
GITHUB_TOKEN : ${{ secrets.ACCESS_TOKEN }}
2024-05-11 10:15:05 +08:00
with :
tag_name : v${{ env.app_version }}
release_name : v${{ env.app_version }}
body : ${{ github.event.commits[0].message }}
draft : false
prerelease : false
- name : Upload Release Asset
uses : dwenegar/upload-release-assets@v1
env :
2024-05-11 10:18:25 +08:00
GITHUB_TOKEN : ${{ secrets.ACCESS_TOKEN }}
2024-05-11 07:34:18 +08:00
with :
2024-05-11 10:15:05 +08:00
release_id : ${{ steps.create_release.outputs.id }}
assets_path : |
./releases/