build:Update release.yaml file to fix file names #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
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 | |
echo "tag=${1}" >> $GITHUB_OUTPUT | |
# 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-${{ needs.capture-version.outputs.tag }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
chaoxing-linux-${{ needs.capture-version.outputs.tag }} | |
chaoxing-macos-${{ needs.capture-version.outputs.tag }} | |
chaoxing-win-${{ needs.capture-version.outputs.tag }}.exe | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} |