Release CLI #75
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: Release CLI | |
on: workflow_dispatch | |
env: | |
APP_NAME: streamyx | |
defaults: | |
run: | |
working-directory: apps/cli | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest, macos-13, ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CONTROL_REPO_TOKEN }} | |
submodules: recursive | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- run: git config --global url."https://${{ secrets.CONTROL_REPO_TOKEN }}@github.com/".insteadOf ssh://[email protected]/ | |
# https://github.com/nodejs/node-gyp/issues/2869 | |
# https://github.com/actions/runner-images/issues/8615#issuecomment-1773563573 | |
- if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' | |
run: python3 -m pip install setuptools --break-system-packages | |
- run: npm ci | |
working-directory: ./ | |
- run: | | |
test -n $(node -p -e "require('./package.json').version") && | |
echo APP_VERSION=$(node -p -e "require('./package.json').version") >> $GITHUB_ENV || exit 1 | |
- if: matrix.os == 'windows-latest' | |
run: npm run build:win | |
- if: matrix.os == 'macos-latest' | |
run: npm run build:mac:arm | |
- if: matrix.os == 'macos-13' | |
run: npm run build:mac | |
- if: matrix.os == 'ubuntu-latest' | |
run: npm run build:linux | |
- run: npm run test | |
- if: ${{ matrix.os == 'windows-latest' }} | |
run: powershell Compress-Archive build\win\streamyx.exe streamyx-x64-win.zip | |
- if: ${{ matrix.os == 'macos-latest' }} | |
run: zip -9 -j ${{ env.APP_NAME }}-arm64-mac.zip ./build/mac-arm/${{ env.APP_NAME }} | |
- if: ${{ matrix.os == 'macos-13' }} | |
run: zip -9 -j ${{ env.APP_NAME }}-x64-mac.zip ./build/mac/${{ env.APP_NAME }} | |
- if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: zip -9 -j ${{ env.APP_NAME }}-x64-linux.zip ./build/linux/${{ env.APP_NAME }} | |
- uses: actions/upload-artifact@v4 | |
if: ${{ matrix.os == 'windows-latest' }} | |
with: | |
name: win-x64 | |
path: ./apps/cli/streamyx-x64-win.zip | |
- uses: actions/upload-artifact@v4 | |
if: ${{ matrix.os == 'macos-latest' }} | |
with: | |
name: mac-arm64 | |
path: ./apps/cli/${{ env.APP_NAME }}-arm64-mac.zip | |
- uses: actions/upload-artifact@v4 | |
if: ${{ matrix.os == 'macos-13' }} | |
with: | |
name: mac-x64 | |
path: ./apps/cli/${{ env.APP_NAME }}-x64-mac.zip | |
- uses: actions/upload-artifact@v4 | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
with: | |
name: linux-x64 | |
path: ./apps/cli/${{ env.APP_NAME }}-x64-linux.zip | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CONTROL_REPO_TOKEN }} | |
submodules: recursive | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: win-x64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: mac-arm64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: mac-x64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux-x64 | |
- name: Get package name and version | |
run: | | |
test -n $(node -p -e "require('./package.json').version") && | |
echo APP_VERSION=$(node -p -e "require('./package.json').version") >> $GITHUB_ENV || exit 1 | |
- name: Create release | |
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 | |
with: | |
artifacts: '${{ env.APP_NAME }}-x64-win.zip, | |
${{ env.APP_NAME }}-arm64-mac.zip, | |
${{ env.APP_NAME }}-x64-mac.zip, | |
${{ env.APP_NAME }}-x64-linux.zip' | |
tag: cli-v${{ env.APP_VERSION }} | |
name: CLI v${{ env.APP_VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: true | |
generateReleaseNotes: true |