Skip to content

Continuous Deployment #22

Continuous Deployment

Continuous Deployment #22

Workflow file for this run

name: Continuous Deployment
on:
push:
tags:
- "v?[0-9]+.[0-9]+.[0-9]+"
jobs:
publish:
name: Publishing for ${{ matrix.job.target }}
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
rust: [stable]
job:
- os: ubuntu-22.04
os-name: linux
target: arm-unknown-linux-gnueabi
architecture: arm
binary-postfix: ""
use-cross: true
- os: ubuntu-22.04
os-name: linux
target: armv7-unknown-linux-gnueabihf
architecture: armv7
binary-postfix: ""
use-cross: true
steps:
- name: Installing Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies to avoid vendored libcec build in libcec-sys
if: ${{ matrix.job.use-cross }}
run: sudo apt-get install libudev-dev libcec6 libcec-dev pkg-config libp8-platform-dev
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
use-cross: ${{ matrix.job.use-cross }}
toolchain: ${{ matrix.rust }}
args: --release --target ${{ matrix.job.target }}
env:
LIBCEC_VENDORED: "1"
- name: install strip command
shell: bash
run: |
sudo apt update
if [[ ${{ matrix.job.target }} == armv7-unknown-linux-gnueabihf ]]; then
BINUTILS=binutils-arm-linux-gnueabihf
else
BINUTILS=$(echo "binutils-${{ matrix.job.target }}"|sed s/unknown-//|tr _ -)
fi
sudo apt-get install -y $BINUTILS
- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.job.target }}/release
####### reduce binary size by removing debug symbols #######
BINARY_NAME=cec-alsa-sync${{ matrix.job.binary-postfix }}
if [[ ${{ matrix.job.target }} == armv7-unknown-linux-gnueabihf ]]; then
GCC_PREFIX=arm-linux-gnueabihf-
else
GCC_PREFIX=$(echo "${{ matrix.job.target }}-"|sed s/unknown-//)
fi
"$GCC_PREFIX"strip $BINARY_NAME
########## create tar.gz ##########
RELEASE_NAME=cec-alsa-sync-${GITHUB_REF/refs\/tags\//}-${{ matrix.job.os-name }}-${{ matrix.job.architecture }}
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME
########## create sha256 ##########
if [[ ${{ runner.os }} == 'Windows' ]]; then
certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256
else
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
fi
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.job.target }}/release/cec-alsa-sync-*.tar.gz
target/${{ matrix.job.target }}/release/cec-alsa-sync-*.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#publish-cargo:
# name: Publishing to Cargo
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@master
# - name: Install dependencies to avoid vendored libcec build in libcec-sys
# run: sudo apt-get install libudev-dev libcec6 libcec-dev pkg-config libp8-platform-dev
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# profile: minimal
# override: true
# - uses: actions-rs/cargo@v1
# with:
# command: publish
# args: --token ${{ secrets.CARGO_API_KEY }} --allow-dirty