diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c87a265..b688a41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,29 +38,3 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: cargo test --all --locked - release: - needs: [lint, test] - strategy: - fail-fast: false - matrix: - include: - - os: macos-latest - target: aarch64-apple-darwin - - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v6 - - uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ matrix.target }} - - uses: Swatinem/rust-cache@v2 - - run: cargo build --release --locked --target ${{ matrix.target }} -p fleetdeck - - name: Package - run: | - mkdir -p dist - tar -C target/${{ matrix.target }}/release -czf dist/fleetdeck-${{ matrix.target }}.tar.gz fleetdeck - - uses: actions/upload-artifact@v4 - with: - name: fleetdeck-${{ matrix.target }} - path: dist/fleetdeck-${{ matrix.target }}.tar.gz diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2b92c02 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,100 @@ +name: Release + +on: + push: + tags: ["v*"] + # Build and package every target on PRs that touch this workflow, without publishing. + pull_request: + paths: [".github/workflows/release.yml"] + +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + +jobs: + version: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@stable + - id: version + name: Check that the tag matches Cargo.toml + run: | + version=$(cargo metadata --no-deps --format-version 1 --locked \ + | jq -r '.packages[] | select(.name == "fleetdeck") | .version') + if [ "$GITHUB_REF_TYPE" = tag ] && [ "$GITHUB_REF_NAME" != "v$version" ]; then + echo "::error::tag $GITHUB_REF_NAME does not match Cargo.toml version $version" + exit 1 + fi + echo "version=$version" >> "$GITHUB_OUTPUT" + + build: + needs: version + strategy: + fail-fast: false + matrix: + include: + - os: macos-latest + target: aarch64-apple-darwin + # Cross-compiled on the arm64 runner; Xcode carries the x86_64 SDK. + - os: macos-latest + target: x86_64-apple-darwin + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: ubuntu-24.04-arm + target: aarch64-unknown-linux-gnu + runs-on: ${{ matrix.os }} + env: + NAME: fleetdeck-${{ needs.version.outputs.version }}-${{ matrix.target }} + steps: + - uses: actions/checkout@v6 + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + - run: cargo build --release --locked --target ${{ matrix.target }} -p fleetdeck + - name: Smoke test + if: matrix.target != 'x86_64-apple-darwin' + run: target/${{ matrix.target }}/release/fleetdeck --version + - name: Package + run: | + mkdir -p "dist/$NAME" + cp target/${{ matrix.target }}/release/fleetdeck README.md LICENSE "dist/$NAME/" + tar -C dist -czf "dist/$NAME.tar.gz" "$NAME" + - uses: actions/upload-artifact@v4 + with: + name: ${{ env.NAME }} + path: dist/${{ env.NAME }}.tar.gz + if-no-files-found: error + + publish: + if: github.ref_type == 'tag' + needs: [version, build] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + - name: Write SHA256SUMS + working-directory: dist + run: | + sha256sum -- *.tar.gz > SHA256SUMS + cat SHA256SUMS + - name: Create the GitHub Release + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "$GITHUB_REF_NAME" dist/*.tar.gz dist/SHA256SUMS \ + --repo "$GITHUB_REPOSITORY" \ + --verify-tag \ + --title "fleetdeck ${{ needs.version.outputs.version }}" \ + --generate-notes diff --git a/README.md b/README.md index 21a4f5b..cc4d8bf 100644 --- a/README.md +++ b/README.md @@ -25,17 +25,62 @@ Press `Enter` on any row to open a detail view: a task with all its meta keys an ## Install +### From a release + +Each [GitHub Release](https://github.com/jayjongcheolpark/fleetdeck/releases) has a `fleetdeck--.tar.gz` archive for these targets: + +| Target | Platform | +| --- | --- | +| `aarch64-apple-darwin` | macOS on Apple silicon | +| `x86_64-apple-darwin` | macOS on Intel | +| `x86_64-unknown-linux-gnu` | Linux x86_64 | +| `aarch64-unknown-linux-gnu` | Linux arm64 | + +Each archive holds the `fleetdeck` binary, this README and the license. + +1. Set the version and the target: + + ```sh + VERSION=0.1.0 + TARGET=aarch64-apple-darwin + ``` + +2. Download the archive and the `SHA256SUMS` file: + + ```sh + BASE=https://github.com/jayjongcheolpark/fleetdeck/releases/download/v$VERSION + curl -fLO "$BASE/fleetdeck-$VERSION-$TARGET.tar.gz" + curl -fLO "$BASE/SHA256SUMS" + ``` + +3. Check the archive against `SHA256SUMS`. + On macOS, use `shasum -a 256` in place of `sha256sum`. + + ```sh + sha256sum --check --ignore-missing SHA256SUMS + ``` + +4. Extract the archive and put the binary on your `PATH`: + + ```sh + tar -xzf "fleetdeck-$VERSION-$TARGET.tar.gz" + install -m 755 "fleetdeck-$VERSION-$TARGET/fleetdeck" ~/.local/bin/fleetdeck + ``` + +If you download the archive with a browser, macOS can block the binary because it is not signed. +To allow it, run `xattr -d com.apple.quarantine ~/.local/bin/fleetdeck`. + +### With cargo + You need a Rust toolchain (1.88 or later) to build from source. ```sh -cargo install --git https://github.com/jayjongcheolpark/fleetdeck fleetdeck +cargo install --git https://github.com/jayjongcheolpark/fleetdeck --tag v0.1.0 fleetdeck ``` +Omit `--tag` to build the latest `main`. From a clone of this repository, use `cargo install --path crates/fleetdeck`. -The CI workflow also builds release binaries for macOS arm64 (`aarch64-apple-darwin`) and Linux x86_64 (`x86_64-unknown-linux-gnu`). -Download them from the artifacts of a CI run on the Actions tab. - ## Configure 1. Create `~/.config/fleetdeck/config.toml` (or `$XDG_CONFIG_HOME/fleetdeck/config.toml`).