Skip to content
name: "Build rendezvous server release binaries"
on:
release:
types: [created]
jobs:
build_binaries:
name: Build rendezvous-server binary
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive_ext: tar
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
archive_ext: tar
runs-on: ${{ matrix.os }}
steps:
- name: Checkout tagged commit
uses: actions/[email protected]
with:
ref: ${{ github.event.release.target_commitish }}
token: ${{ secrets.BOTTY_GITHUB_TOKEN }}
- name: Install toolchain from rust-toolchain file
run: rustup show
- uses: Swatinem/[email protected]
with:
key: ${{ matrix.target }}
- name: Install compiler for armhf arch
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
run: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf
- name: Build ${{ matrix.target }} rendezvous-server release binary
run: cargo build --target=${{ matrix.target }} --release --package rendezvous-server --bin rendezvous-server
- name: Smoke test the binary
if: matrix.target != 'armv7-unknown-linux-gnueabihf'
run: target/${{ matrix.target }}/release/rendezvous-server --help
# Remove once python 3 is the default
- uses: actions/[email protected]
with:
python-version: '3.x'
- id: create-archive-name
shell: python # Use python to have a prettier name for the archive on Windows.
run: |
import platform
os_info = platform.uname()
arch = os_info.machine
triple = "${{ matrix.target }}".split("-")
arch = triple[0]
archive_name=f'rendezvous-server_${{ github.event.release.tag_name }}_{os_info.system}_{arch}.${{ matrix.archive_ext }}'
print(f'::set-output name=archive::{archive_name}')
- name: Pack linux archive
if: matrix.os == 'ubuntu-latest'
shell: bash
run: tar -C ./target/${{ matrix.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} rendezvous-server
- name: Upload archive
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.create-archive-name.outputs.archive }}
asset_name: ${{ steps.create-archive-name.outputs.archive }}
asset_content_type: application/gzip