diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3431d42..e9cca30 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -67,3 +67,102 @@ jobs: run: cargo publish --token ${CARGO_REGISTRY_TOKEN} env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + + build-cli-artifacts: + needs: [tag-release] + runs-on: ${{ matrix.os }} + env: + TARGET_FLAGS: + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu + - os: ubuntu-latest + target: aarch64-unknown-linux-musl + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + - os: macos-latest + target: x86_64-apple-darwin + - os: macos-latest + target: x86_64-apple-darwin + - os: macos-latest + target: aarch64-apple-darwin + - os: windows-latest + target: aarch64-pc-windows-msvc + - os: windows-latest + target: x86_64-pc-windows-msvc + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Set up Rust + run: rustup toolchain add --profile minimal --target ${{ matrix.target }} stable + + - name: Install cross + run: cargo install cross + + - name: Set target variables + shell: bash + run: | + echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV + echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV + + - name: Build release binary + shell: bash + # cd ensures we only pull in CLI dependencies + run: | + cross build --release ${{ env.TARGET_FLAGS }} + if [ "${{ matrix.os }}" = "windows-latest" ]; then + bin="target/${{ matrix.target }}/release/epoch.exe" + else + bin="target/${{ matrix.target }}/release/epoch" + fi + stat $bin + echo "BIN=$bin" >> $GITHUB_ENV + + - name: Determine archive name + shell: bash + run: | + version="$(scripts/get_version.sh)" + echo "ARCHIVE=epoch-$version-${{ matrix.target }}" >> $GITHUB_ENV + echo "VERSION=$version" >> $GITHUB_ENV + + - name: Creating directory for archive + shell: bash + run: | + mkdir -p "$ARCHIVE"/doc + cp "$BIN" "$ARCHIVE"/ + cp {README.md,LICENSE} "$ARCHIVE"/ + cp CHANGELOG.md "$ARCHIVE"/doc/ + + - name: Build archive (Windows) + shell: bash + if: matrix.os == 'windows-latest' + run: | + 7z a "$ARCHIVE.zip" "$ARCHIVE" + certutil -hashfile "$ARCHIVE.zip" SHA256 > "$ARCHIVE.zip.sha256" + echo "ASSET=$ARCHIVE.zip" >> $GITHUB_ENV + echo "ASSET_SUM=$ARCHIVE.zip.sha256" >> $GITHUB_ENV + + - name: Build archive (Unix) + shell: bash + if: matrix.os != 'windows-latest' + run: | + tar czf "$ARCHIVE.tar.gz" "$ARCHIVE" + shasum -a 256 "$ARCHIVE.tar.gz" > "$ARCHIVE.tar.gz.sha256" + echo "ASSET=$ARCHIVE.tar.gz" >> $GITHUB_ENV + echo "ASSET_SUM=$ARCHIVE.tar.gz.sha256" >> $GITHUB_ENV + + - name: Upload release archive + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + # clobber to overwrite if we have to rerun the release + run: | + gh release upload v${{ env.VERSION }} ${{ env.ASSET }} ${{ env.ASSET_SUM }} --clobber diff --git a/CHANGELOG.md b/CHANGELOG.md index ffa7226..ce2ce41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +## 0.3.1 - 2025-12-03 +- Add pre-built binaries to the release artifacts + ## 0.3.0 - 2025-09-11 - Initial public release diff --git a/Cargo.toml b/Cargo.toml index ffd1501..2bd429a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "epoch-to" authors = ["Databento "] -version = "0.3.0" +version = "0.3.1" edition = "2021" repository = "https://github.com/databento/epoch" description = "CLI tool for converting UNIX timestamps to human-readable date strings"