2021-10-07 18:08:37 +00:00
|
|
|
name: Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- v[0-9]+.[0-9]+.[0-9]+
|
|
|
|
- v[0-9]+.[0-9]+.[0-9]+-**
|
2023-07-05 23:30:44 +00:00
|
|
|
- latest
|
|
|
|
|
2023-07-05 23:44:56 +00:00
|
|
|
# Status of Targets:
|
2023-07-05 23:30:44 +00:00
|
|
|
#
|
2023-07-05 23:44:56 +00:00
|
|
|
# ✅ x86_64-apple-darwin
|
|
|
|
# ✅ aarch64-apple-darwin
|
2023-07-05 23:30:44 +00:00
|
|
|
#
|
2023-07-05 23:44:56 +00:00
|
|
|
# ✅ x86_64-pc-windows-msvc
|
|
|
|
# ✅ aarch64-pc-windows-msvc
|
2023-07-05 23:30:44 +00:00
|
|
|
#
|
2023-07-05 23:44:56 +00:00
|
|
|
# ✅ x86_64-unknown-linux-gnu
|
|
|
|
# ✅ aarch64-unknown-linux-gnu
|
|
|
|
# ❌ aarch64-linux-android (fails due to termios)
|
|
|
|
# ✅ armv7-unknown-linux-gnueabihf
|
2023-07-05 23:30:44 +00:00
|
|
|
#
|
2023-07-05 23:44:56 +00:00
|
|
|
# ✅ x86_64-unknown-linux-musl
|
|
|
|
# ✅ aarch64-unknown-linux-musl
|
2023-07-05 23:30:44 +00:00
|
|
|
#
|
2023-07-05 23:44:56 +00:00
|
|
|
# ✅ x86_64-unknown-freebsd
|
|
|
|
# ❓ aarch64-unknown-freebsd (works manually, but cannot cross-compile via CI)
|
2023-07-05 23:30:44 +00:00
|
|
|
#
|
2023-07-05 23:44:56 +00:00
|
|
|
# ❌ x86_64-unknown-netbsd (fails due to termios)
|
|
|
|
# ❌ aarch64-unknown-netbsd (???)
|
2023-07-05 23:30:44 +00:00
|
|
|
#
|
2023-07-05 23:44:56 +00:00
|
|
|
# ❌ x86_64-unknown-openbsd (fails due to rustc internal error at end)
|
|
|
|
# ❌ aarch64-unknown-openbsd (fails due to openssl-src)
|
2023-07-05 23:30:44 +00:00
|
|
|
#
|
2021-10-07 18:08:37 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
macos:
|
2023-07-05 23:30:44 +00:00
|
|
|
name: "Build release on MacOS (${{ matrix.target }})"
|
2021-10-07 18:08:37 +00:00
|
|
|
runs-on: macos-11.0
|
2023-07-05 23:30:44 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target:
|
|
|
|
- x86_64-apple-darwin
|
|
|
|
- aarch64-apple-darwin
|
2021-10-07 18:08:37 +00:00
|
|
|
steps:
|
2022-08-28 06:52:36 +00:00
|
|
|
- uses: actions/checkout@v3
|
2023-07-05 23:30:44 +00:00
|
|
|
- name: Install Rust (${{ matrix.target }})
|
2021-10-07 18:08:37 +00:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
2023-07-05 23:30:44 +00:00
|
|
|
target: ${{ matrix.target }}
|
|
|
|
override: true
|
2022-08-28 06:52:36 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2023-07-05 23:30:44 +00:00
|
|
|
- name: Build binary (${{ matrix.target }})
|
2021-10-07 18:08:37 +00:00
|
|
|
run: |
|
2023-07-05 23:30:44 +00:00
|
|
|
cargo build --release --all-features --target ${{ matrix.target }}
|
|
|
|
mv ./target/${{ matrix.target }}/release/distant ./distant-${{ matrix.target }}
|
|
|
|
chmod +x ./distant-${{ matrix.target }}
|
2021-10-07 18:08:37 +00:00
|
|
|
- name: Upload
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2023-07-05 23:30:44 +00:00
|
|
|
name: ${{ matrix.target }}
|
|
|
|
path: ./distant-${{ matrix.target }}
|
2023-07-05 23:44:56 +00:00
|
|
|
if-no-files-found: error
|
|
|
|
retention-days: 5
|
|
|
|
|
|
|
|
macos_unify:
|
|
|
|
name: "Build universal binary on MacOS"
|
|
|
|
needs: [macos]
|
|
|
|
runs-on: macos-11.0
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/download-artifact@v2
|
|
|
|
- name: Unify binaries
|
|
|
|
run: |
|
|
|
|
lipo -create -output distant-universal-apple-darwin \
|
|
|
|
./x86_64-apple-darwin/distant-x86_64-apple-darwin \
|
|
|
|
./aarch64-apple-darwin/distant-aarch64-apple-darwin
|
|
|
|
chmod +x ./distant-universal-apple-darwin
|
|
|
|
- name: Upload
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: universal-apple-darwin
|
|
|
|
path: ./distant-universal-apple-darwin
|
|
|
|
if-no-files-found: error
|
|
|
|
retention-days: 5
|
2021-10-07 18:08:37 +00:00
|
|
|
|
|
|
|
windows:
|
2023-07-05 23:30:44 +00:00
|
|
|
name: "Build release on Windows (${{ matrix.target }})"
|
2021-10-07 18:08:37 +00:00
|
|
|
runs-on: windows-latest
|
2023-07-05 23:30:44 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target:
|
|
|
|
- x86_64-pc-windows-msvc
|
|
|
|
- aarch64-pc-windows-msvc
|
2021-10-07 18:08:37 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2023-07-05 23:30:44 +00:00
|
|
|
- name: Install Rust (${{ matrix.target }})
|
2021-10-07 18:08:37 +00:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
2023-07-05 23:30:44 +00:00
|
|
|
target: ${{ matrix.target }}
|
|
|
|
override: true
|
2022-11-20 03:40:03 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2023-07-05 23:30:44 +00:00
|
|
|
- name: Build binary (${{ matrix.target }})
|
2022-11-20 03:40:03 +00:00
|
|
|
run: |
|
2023-07-05 23:30:44 +00:00
|
|
|
cargo build --release --all-features --target ${{ matrix.target }}
|
|
|
|
mv ./target/${{ matrix.target }}/release/distant.exe ./distant-${{ matrix.target }}.exe
|
|
|
|
chmod +x ./distant-${{ matrix.target }}.exe
|
2022-11-20 03:40:03 +00:00
|
|
|
- name: Upload
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2023-07-05 23:30:44 +00:00
|
|
|
name: ${{ matrix.target }}
|
|
|
|
path: ./distant-${{ matrix.target }}.exe
|
2023-07-05 23:44:56 +00:00
|
|
|
if-no-files-found: error
|
|
|
|
retention-days: 5
|
2022-11-20 03:40:03 +00:00
|
|
|
|
2023-07-05 23:30:44 +00:00
|
|
|
linux:
|
|
|
|
name: "Build release on Linux (${{ matrix.target }})"
|
2021-10-13 16:09:46 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-07-05 23:30:44 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- target: x86_64-unknown-linux-gnu
|
|
|
|
build: --all-features
|
2023-07-05 23:44:56 +00:00
|
|
|
cargo: cargo
|
2023-07-05 23:30:44 +00:00
|
|
|
- target: aarch64-unknown-linux-gnu
|
|
|
|
build: --all-features
|
|
|
|
deps: gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
|
2023-07-05 23:44:56 +00:00
|
|
|
cargo: cargo
|
2023-07-05 23:30:44 +00:00
|
|
|
- target: armv7-unknown-linux-gnueabihf
|
|
|
|
build: --all-features
|
|
|
|
deps: gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
|
2023-07-05 23:44:56 +00:00
|
|
|
cargo: cargo
|
2023-07-05 23:30:44 +00:00
|
|
|
- target: x86_64-unknown-linux-musl
|
|
|
|
build: --no-default-features --features ssh2
|
|
|
|
deps: musl-tools
|
2023-07-05 23:44:56 +00:00
|
|
|
cargo: cargo
|
2023-07-05 23:30:44 +00:00
|
|
|
- target: aarch64-unknown-linux-musl
|
|
|
|
build: --no-default-features --features ssh2
|
|
|
|
deps: musl-tools gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
|
2023-07-05 23:44:56 +00:00
|
|
|
cargo: cross
|
|
|
|
prepare: |
|
|
|
|
curl -L "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz" |
|
|
|
|
tar xz -C $HOME/.cargo/bin
|
|
|
|
- target: x86_64-unknown-freebsd
|
|
|
|
build: --all-features
|
|
|
|
cargo: cross
|
|
|
|
prepare: |
|
|
|
|
curl -L "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz" |
|
|
|
|
tar xz -C $HOME/.cargo/bin
|
2021-10-13 16:09:46 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2023-07-05 23:30:44 +00:00
|
|
|
- name: Install Rust (${{ matrix.target }})
|
2022-11-20 04:59:17 +00:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
2023-07-05 23:30:44 +00:00
|
|
|
target: ${{ matrix.target }}
|
2022-11-20 04:59:17 +00:00
|
|
|
override: true
|
2023-07-05 23:30:44 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Install dependencies
|
|
|
|
if: ${{ matrix.deps }}
|
2021-10-13 16:09:46 +00:00
|
|
|
run: |
|
2023-05-23 19:36:24 +00:00
|
|
|
sudo apt update
|
2023-07-05 23:30:44 +00:00
|
|
|
sudo apt install -y ${{ matrix.deps }}
|
2023-07-05 23:44:56 +00:00
|
|
|
- name: Preparing system
|
|
|
|
if: ${{ matrix.prepare }}
|
|
|
|
run: ${{ matrix.prepare }}
|
2023-07-05 23:30:44 +00:00
|
|
|
- name: Build binary (${{ matrix.target }})
|
2021-10-07 18:08:37 +00:00
|
|
|
run: |
|
2023-07-05 23:44:56 +00:00
|
|
|
${{ matrix.cargo }} build --release ${{ matrix.build }} --target ${{ matrix.target }}
|
2023-07-05 23:30:44 +00:00
|
|
|
mv ./target/${{ matrix.target }}/release/distant ./distant-${{ matrix.target }}
|
|
|
|
chmod +x ./distant-${{ matrix.target }}
|
2021-10-07 18:08:37 +00:00
|
|
|
- name: Upload
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2023-07-05 23:30:44 +00:00
|
|
|
name: ${{ matrix.target }}
|
|
|
|
path: ./distant-${{ matrix.target }}
|
2023-07-05 23:44:56 +00:00
|
|
|
if-no-files-found: error
|
|
|
|
retention-days: 5
|
2021-10-07 18:08:37 +00:00
|
|
|
|
2023-07-05 23:44:56 +00:00
|
|
|
# bsd:
|
|
|
|
# name: "Build release on ${{ matrix.os.name }} (${{ matrix.os.target }})"
|
|
|
|
# runs-on: ${{ matrix.os.host }}
|
|
|
|
# strategy:
|
|
|
|
# matrix:
|
|
|
|
# os:
|
|
|
|
# - name: freebsd
|
|
|
|
# architecture: x86-64
|
|
|
|
# version: '13.2'
|
|
|
|
# host: macos-12
|
|
|
|
# target: x86_64-unknown-freebsd
|
|
|
|
# build: --all-features
|
|
|
|
# prepare: sudo pkg install -y openssl gmake lang/rust devel/llvm-devel
|
|
|
|
# - name: netbsd
|
|
|
|
# architecture: x86-64
|
|
|
|
# version: '9.3'
|
|
|
|
# host: macos-12
|
|
|
|
# target: x86_64-unknown-netbsd
|
|
|
|
# build: --all-features
|
|
|
|
# prepare: |
|
|
|
|
# PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
|
|
|
|
# PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages"
|
|
|
|
# PKG_PATH="$PKG_PATH/NetBSD/x86_64/9.3/All/"
|
|
|
|
# export PATH PKG_PATH
|
|
|
|
# sudo -E pkg_add -I gmake rust
|
|
|
|
# cargo update --dry-run
|
|
|
|
# - name: openbsd
|
|
|
|
# architecture: x86-64
|
|
|
|
# version: '7.3'
|
|
|
|
# host: macos-12
|
|
|
|
# target: x86_64-unknown-openbsd
|
|
|
|
# build: --all-features
|
|
|
|
# prepare: |
|
|
|
|
# sudo pkg_add -I gmake rust llvm
|
|
|
|
# sed -i 's/lto = true/lto = false/' Cargo.toml
|
|
|
|
# steps:
|
|
|
|
# - uses: actions/checkout@v3
|
|
|
|
# - uses: Swatinem/rust-cache@v2
|
|
|
|
# - name: Build in VM
|
|
|
|
# uses: cross-platform-actions/action@v0.15.0
|
|
|
|
# env:
|
|
|
|
# CARGO_INCREMENTAL: 0
|
|
|
|
# with:
|
|
|
|
# environment_variables: CARGO_INCREMENTAL
|
|
|
|
# operating_system: ${{ matrix.os.name }}
|
|
|
|
# architecture: ${{ matrix.os.architecture }}
|
|
|
|
# version: ${{ matrix.os.version }}
|
|
|
|
# shell: bash
|
|
|
|
# run: |
|
|
|
|
# ${{ matrix.os.prepare }}
|
|
|
|
# cargo build --release ${{ matrix.os.build }} --target ${{ matrix.os.target }}
|
|
|
|
# mv ./target/${{ matrix.os.target }}/release/distant ./distant-${{ matrix.os.target }}
|
|
|
|
# chmod +x ./distant-${{ matrix.os.target }}
|
|
|
|
# - name: Upload
|
|
|
|
# uses: actions/upload-artifact@v2
|
|
|
|
# with:
|
|
|
|
# name: ${{ matrix.os.target }}
|
|
|
|
# path: ./distant-${{ matrix.os.target }}
|
|
|
|
# if-no-files-found: error
|
|
|
|
# retention-days: 5
|
2022-11-20 04:59:17 +00:00
|
|
|
|
2021-10-07 18:08:37 +00:00
|
|
|
publish:
|
2023-07-05 23:44:56 +00:00
|
|
|
needs: [macos, macos_unify, windows, linux]
|
2021-10-07 18:08:37 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
steps:
|
|
|
|
- uses: actions/download-artifact@v2
|
2023-07-05 23:30:44 +00:00
|
|
|
- name: Generate SHA256 checksums
|
2022-11-20 03:40:03 +00:00
|
|
|
run: |
|
2023-07-05 23:30:44 +00:00
|
|
|
for i in $(find . -name "distant-*" -type f); do
|
|
|
|
echo "Generating checksum for ${i}"
|
|
|
|
sha256sum "${i}" > "${i}.sha256sum"
|
|
|
|
done
|
2021-10-07 18:08:37 +00:00
|
|
|
- name: Determine git tag
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
run: |
|
|
|
|
TAG_NAME=${{ github.ref }}
|
|
|
|
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
|
2022-05-29 19:04:48 +00:00
|
|
|
echo "TAG_VERSION=${TAG_NAME#refs/tags/v}" >> $GITHUB_ENV
|
2023-07-05 23:30:44 +00:00
|
|
|
- name: Check git tag for pre-release or latest
|
2021-10-08 20:13:08 +00:00
|
|
|
id: check-tag
|
|
|
|
run: |
|
|
|
|
if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+-.*$ ]]; then
|
2023-07-05 23:44:56 +00:00
|
|
|
echo "is_prerelease=true" >> $GITHUB_OUTPUT
|
2023-07-05 23:30:44 +00:00
|
|
|
elif [[ ${{ github.ref }} =~ ^refs/tags/latest$ ]]; then
|
2023-07-05 23:44:56 +00:00
|
|
|
echo "is_latest=true" >> $GITHUB_OUTPUT
|
2021-10-08 20:13:08 +00:00
|
|
|
fi
|
|
|
|
- name: Print pre-release status
|
|
|
|
run: |
|
2023-07-05 23:44:56 +00:00
|
|
|
echo "Is ${{ github.ref }} pre-release: ${{ steps.check-tag.outputs.is_prerelease }}"
|
|
|
|
echo "Is ${{ github.ref }} latest: ${{ steps.check-tag.outputs.is_latest }}"
|
2022-05-29 19:04:48 +00:00
|
|
|
- name: Get Changelog Entry
|
|
|
|
id: changelog
|
|
|
|
uses: mindsers/changelog-reader-action@v2
|
|
|
|
with:
|
|
|
|
version: ${{ env.TAG_VERSION }}
|
|
|
|
path: "./CHANGELOG.md"
|
2023-07-05 23:44:56 +00:00
|
|
|
if: ${{ steps.check-tag.outputs.is_latest != 'true' }}
|
|
|
|
- name: Publish (latest)
|
|
|
|
if: ${{ steps.check-tag.outputs.is_latest == 'true' }}
|
2021-10-07 18:08:37 +00:00
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
2023-07-05 23:44:56 +00:00
|
|
|
name: Latest Build
|
2021-10-07 18:08:37 +00:00
|
|
|
fail_on_unmatched_files: true
|
|
|
|
target_commitish: ${{ github.sha }}
|
|
|
|
draft: false
|
2023-07-05 23:44:56 +00:00
|
|
|
prerelease: true
|
2021-10-07 18:08:37 +00:00
|
|
|
files: |
|
2023-07-05 23:30:44 +00:00
|
|
|
**/distant-*
|
2021-10-07 18:08:37 +00:00
|
|
|
body: |
|
2023-07-05 23:30:44 +00:00
|
|
|
This is the latest commit (${{ github.sha }}) built for testing.
|
|
|
|
This is not guaranteed to pass all tests or even function properly.
|
2023-07-05 23:44:56 +00:00
|
|
|
- name: Publish (release)
|
|
|
|
if: ${{ steps.check-tag.outputs.is_latest != 'true' }}
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
name: distant ${{ env.TAG_NAME }}
|
|
|
|
fail_on_unmatched_files: true
|
|
|
|
target_commitish: ${{ github.sha }}
|
|
|
|
draft: false
|
|
|
|
prerelease: ${{ steps.check-tag.outputs.is_prerelease == 'true' }}
|
|
|
|
files: |
|
|
|
|
**/distant-*
|
|
|
|
body: |
|
|
|
|
## Release Notes
|
|
|
|
${{ steps.changelog.outputs.changes }}
|