Skip to content

build:Update artifact names in release.yaml #9

build:Update artifact names in release.yaml

build:Update artifact names in release.yaml #9

Workflow file for this run

name: Build and Release
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Dependencies
run: npm install
- name: Run build script
run: npm run build
- name: Install ncc
run: npm install @vercel/ncc -g
- name: Build with ncc
run: ncc build dist/index.js -o package
- name: Package with pkg
run: npx pkg package/index.js --targets node16-linux,node16-macos,node16-win -o package/chaoxing
- name: Capture the version tag
id: vars
run: echo "tag=1" >> $GITHUB_ENV
# run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Rename artifacts to include version number
run: |
mv package/chaoxing-linux package/chaoxing-linux-${{ env.tag }}
mv package/chaoxing-macos package/chaoxing-macos-${{ env.tag }}
mv package/chaoxing-win.exe package/chaoxing-win-${{ env.tag }}.exe
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: chaoxing-${{ env.tag }}
path: |
package/chaoxing-linux-${{ env.tag }}
package/chaoxing-macos-${{ env.tag }}
package/chaoxing-win-${{ env.tag }}.exe
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: chaoxing-${{ env.tag }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
chaoxing-${{ env.tag }}-linux
chaoxing-${{ env.tag }}-macos
chaoxing-${{ env.tag }}-win.exe
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}