mirror of
https://github.com/sipeed/NanoKVM-USB.git
synced 2026-11-09 17:04:27 -06:00
CI: automatically get version number from package.json
This commit is contained in:
36
.github/workflows/release.yml
vendored
36
.github/workflows/release.yml
vendored
@@ -3,10 +3,6 @@ name: Create Tag and Release
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
|
||||||
description: 'Tag name'
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
prerelease:
|
prerelease:
|
||||||
description: 'Mark as pre-release'
|
description: 'Mark as pre-release'
|
||||||
required: false
|
required: false
|
||||||
@@ -25,18 +21,26 @@ jobs:
|
|||||||
create-tag:
|
create-tag:
|
||||||
name: Create Git Tag
|
name: Create Git Tag
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
release_tag: ${{ steps.version.outputs.tag }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Read version from package.json
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION=$(jq -r .version desktop/package.json)
|
||||||
|
echo "tag=v${VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Create and push tag
|
- name: Create and push tag
|
||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git tag -a ${{ inputs.tag }} -m "Release ${{ inputs.tag }}"
|
git tag -a ${{ steps.version.outputs.tag }} -m "Release ${{ steps.version.outputs.tag }}"
|
||||||
git push origin ${{ inputs.tag }}
|
git push origin ${{ steps.version.outputs.tag }}
|
||||||
|
|
||||||
build-browser:
|
build-browser:
|
||||||
name: Build Browser Bundle
|
name: Build Browser Bundle
|
||||||
@@ -49,7 +53,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.tag }}
|
ref: ${{ needs.create-tag.outputs.release_tag }}
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@@ -64,16 +68,16 @@ jobs:
|
|||||||
|
|
||||||
- name: Create browser archive
|
- name: Create browser archive
|
||||||
run: |
|
run: |
|
||||||
cd dist
|
cd dist
|
||||||
zip -r ../nanokvm-usb-browser-${{ inputs.tag }}.zip .
|
zip -r ../nanokvm-usb-browser-${{ needs.create-tag.outputs.release_tag }}.zip .
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
- name: Upload browser artifact
|
- name: Upload browser artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: browser-release
|
name: browser-release
|
||||||
path: browser/nanokvm-usb-browser-${{ inputs.tag }}.zip
|
path: browser/nanokvm-usb-browser-${{ needs.create-tag.outputs.release_tag }}.zip
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
build-desktop:
|
build-desktop:
|
||||||
name: Build Desktop Apps
|
name: Build Desktop Apps
|
||||||
@@ -107,7 +111,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.tag }}
|
ref: ${{ needs.create-tag.outputs.release_tag }}
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@@ -165,8 +169,8 @@ jobs:
|
|||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ inputs.tag }}
|
tag_name: ${{ needs.create-tag.outputs.release_tag }}
|
||||||
name: ${{ inputs.tag }}
|
name: ${{ needs.create-tag.outputs.release_tag }}
|
||||||
draft: ${{ inputs.draft }}
|
draft: ${{ inputs.draft }}
|
||||||
prerelease: ${{ inputs.prerelease }}
|
prerelease: ${{ inputs.prerelease }}
|
||||||
files: |
|
files: |
|
||||||
|
|||||||
Reference in New Issue
Block a user