diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ba4a117 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,83 @@ +name: Release CLI + +on: + workflow_dispatch: + inputs: + version: + required: true + type: string + description: "The version of the CLI to build (e.g. v1.6.0-beta.1)" + +jobs: + build: + name: Release - ${{ matrix.platform.release_for }} + strategy: + matrix: + platform: + - release_for: Linux-aarch64 + os: ubuntu-20.04 + target: aarch64-unknown-linux-gnu + bin: runtipi-cli + name: runtipi-cli-Linux-aarch64.tar.gz + command: build + + - release_for: Linux-x86_64 + os: ubuntu-20.04 + target: x86_64-unknown-linux-gnu + bin: runtipi-cli + name: runtipi-cli-Linux-x86_64.tar.gz + command: build + + - release_for: macOS-aarch64 + os: macOS-latest + target: aarch64-apple-darwin + bin: runtipi-cli + name: runtipi-cli-Darwin-aarch64.tar.gz + command: build + + runs-on: ${{ matrix.platform.os }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set version in src/assets/VERSION + run: | + echo "${{ inputs.version }}" > src/assets/VERSION + + - name: Build binary + uses: houseabsolute/actions-rust-cross@v0 + with: + command: ${{ matrix.platform.command }} + target: ${{ matrix.platform.target }} + args: "--locked --release" + strip: true + + - name: Upload CLI + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.platform.name }} + path: target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} + + release: + runs-on: ubuntu-latest + needs: build + steps: + - uses: rickstaa/action-create-tag@v1 + with: + tag: ${{ inputs.version }} + + - name: Create release + uses: actions/create-release@v1 + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ inputs.version }} + release_name: ${{ inputs.version }} + draft: false + prerelease: true + + - name: Download CLI artifacts + uses: actions/download-artifact@v2 + with: + name: runtipi-cli-*.tar.gz