name: Build Client to Release on: push: branches: - main paths: - 'client/**' workflow_dispatch: jobs: build: runs-on: ubuntu-22.04 steps: - name: Checkout Repository uses: actions/checkout@v3 - name: Set up Node.js uses: actions/setup-node@v3 with: node-version: '20' - name: Install dependencies run: npm install working-directory: client - name: Build for Linux x64 run: npm run pkglinux:x64 working-directory: client - name: Install QEMU # 设置qemu 支持arm的虚拟环境 run: sudo apt-get update && sudo apt-get install -y qemu qemu-user-static binfmt-support - name: Setup QEMU ARM64 run: | sudo update-binfmts --enable qemu-aarch64 sudo cp /usr/bin/qemu-aarch64-static /usr/local/bin uname -a - name: Build for Linux arm64 run: npm run pkglinux:arm64 working-directory: client - name: Set tag name id: tag_name run: echo "TAG_NAME=client-$(date +'%Y-%m-%d')" >> $GITHUB_ENV - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ env.TAG_NAME }} release_name: ${{ env.TAG_NAME }} draft: false prerelease: false - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps asset_path: client/dist/easynode-client-x64 asset_name: easynode-client-x64 asset_content_type: application/octet-stream - name: Upload Linux ARM64 Binary to Release uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: client/dist/easynode-client-arm64 asset_name: easynode-client-arm64 asset_content_type: application/octet-stream