v1.0.1 #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Build | |
on: | |
release: | |
types: [created] | |
env: | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build-binaries: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
target: | |
- x86_64-unknown-linux-gnu | |
- aarch64-unknown-linux-gnu | |
- armv7-unknown-linux-gnueabihf | |
- arm-unknown-linux-gnueabihf | |
- x86_64-apple-darwin | |
- aarch64-apple-darwin | |
exclude: | |
- os: ubuntu-latest | |
target: x86_64-apple-darwin | |
- os: ubuntu-latest | |
target: aarch64-apple-darwin | |
- os: macos-latest | |
target: x86_64-unknown-linux-gnu | |
- os: macos-latest | |
target: aarch64-unknown-linux-gnu | |
- os: macos-latest | |
target: armv7-unknown-linux-gnueabihf | |
- os: macos-latest | |
target: arm-unknown-linux-gnueabihf | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
- name: Build Binary | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --release --target ${{ matrix.target }} | |
- name: Package Binary | |
run: | | |
mkdir -p release | |
cp target/${{ matrix.target }}/release/ovos_messagebus release/ovos_messagebus-${{ matrix.target }} | |
cd release && tar czvf ovos_messagebus-${{ matrix.target }}.tar.gz ovos_messagebus-${{ matrix.target }} | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
shasum -a 256 ovos_messagebus-${{ matrix.target }}.tar.gz > ovos_messagebus-${{ matrix.target }}.tar.gz.sha256 | |
else | |
sha256sum ovos_messagebus-${{ matrix.target }}.tar.gz > ovos_messagebus-${{ matrix.target }}.tar.gz.sha256 | |
fi | |
- name: Upload Release Asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload ${{ github.event.release.tag_name }} \ | |
release/ovos_messagebus-${{ matrix.target }}.tar.gz \ | |
release/ovos_messagebus-${{ matrix.target }}.tar.gz.sha256 | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
architecture: [linux/amd64, linux/arm64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Lowercase Repository Name | |
id: lowercase_repo | |
run: echo "REPO_LOWERCASE=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: ${{ matrix.architecture }} | |
push: true | |
tags: | | |
ghcr.io/${{ steps.lowercase_repo.outputs.REPO_LOWERCASE }}:latest | |
ghcr.io/${{ steps.lowercase_repo.outputs.REPO_LOWERCASE }}:${{ github.sha }} | |
ghcr.io/${{ steps.lowercase_repo.outputs.REPO_LOWERCASE }}:${{ github.event.release.tag_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |