Skip to content

Binary

Binary #13

Workflow file for this run

name: Binary
on:
workflow_run:
workflows: [ Deploy ]
types: [ completed ]
release:
types: [ created ]
workflow_dispatch:
jobs:
get_last_release:
runs-on: ubuntu-latest
outputs:
latest_release_tag: ${{ steps.latest-release.outputs.LATEST_RELEASE_TAG }}
steps:
- uses: actions/checkout@v4
- name: Extract the latest release
id: latest-release
run: echo "LATEST_RELEASE_TAG=$(gh release ls --json isLatest,tagName -q '.[] | select(.isLatest == true) | .tagName')" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
name: Build
runs-on: ${{matrix.platform.image}}
container: ghcr.io/jakestanger/ironbar-build:master
needs: get_last_release
strategy:
fail-fast: false
matrix:
platform:
- { image: ubuntu-latest, name: x86_64 }
- { image: ubuntu-latest-arm, name: arm64 }
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.get_last_release.outputs.latest_release_tag }}
- name: Add OpenSSL crate (vendored)
run: cargo add openssl --features vendored
- name: Cross Build Release
run: cargo build --locked --release
- name: Get name of Binary from metadata
run: echo "BINARY_NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].targets[] | select( .kind | map(. == "bin") | any ) | .name')" >> $GITHUB_ENV
- name: Compress the built binary
run: tar -zcvf ${{env.BINARY_NAME}}-${{needs.get_last_release.outputs.latest_release_tag}}-${{matrix.platform.name}}.tar.gz -C target/${{matrix.platform.name}}/release ${{env.BINARY_NAME}}
- name: Upload to release
run: gh release upload ${{needs.get_last_release.outputs.latest_release_tag}} ${{env.BINARY_NAME}}-${{needs.get_last_release.outputs.latest_release_tag}}-${{matrix.platform.name}}.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The triggering workflow Deploy failed'
- run: exit 1