From df1bef2ccdadfd0e38cca174dabe412ff07a5de2 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Mon, 16 Dec 2024 22:01:31 +1100 Subject: [PATCH] feat: build and release binaries to GH releases Note that I can't really test this, but I successfully use something similar in an existing project. --- .github/workflows/cli-release.yml | 56 +++++++++++++++++++++++++++++++ .gitignore | 4 +++ 2 files changed, 60 insertions(+) create mode 100644 .github/workflows/cli-release.yml diff --git a/.github/workflows/cli-release.yml b/.github/workflows/cli-release.yml new file mode 100644 index 000000000000..9dcf7747b146 --- /dev/null +++ b/.github/workflows/cli-release.yml @@ -0,0 +1,56 @@ +on: + push: + tags: + - "v1.*" + workflow_dispatch: +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true +name: Release CLI +jobs: + build: + name: Build ${{ matrix.os }}-${{ matrix.architecture }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + architecture: [x86_64, aarch64] + include: + - os: ubuntu-latest + suffix: unknown-linux-gnu + - os: macos-latest + suffix: apple-darwin + steps: + - uses: actions/checkout@v4 + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + target: ${{ matrix.architecture }}-${{ matrix.suffix }} + - id: build + shell: bash + run: | + export TARGET=${{ matrix.architecture }}-${{ matrix.suffix }} + cargo build --release --target $TARGET + cd target/${TARGET}/release + tar -cjf goose-${TARGET}.tar.bz2 goose goosed + export TARGET_PATH="target/${TARGET}/release/goose-${TARGET}.tar.bz2" + echo "TARGET_PATH=${TARGET_PATH}" >> $GITHUB_OUTPUT + - uses: actions/upload-artifact@v4 + with: + name: goose-${{ matrix.architecture }}-${{ matrix.suffix }} + path: ${{ steps.build.outputs.TARGET_PATH }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + release: + name: Release + runs-on: ubuntu-latest + needs: [build] + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + merge-multiple: true + - uses: ncipollo/release-action@v1 + with: + artifacts: "goose-*.bz2" diff --git a/.gitignore b/.gitignore index cee516b0b299..63a20930b708 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,7 @@ Cargo.lock # UI ./ui/desktop/node_modules ./ui/desktop/out + +# Hermit +/.hermit/ +/bin/