Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release automation workflow for binary distribution #97

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release

on:
push:
branches:
- main
tags: ['v*']

jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
target:
- x86_64-unknown-linux-musl

steps:
- uses: actions/checkout@v4.1.1

- name: install apt depenedencies
run: |
sudo apt-get update
sudo apt-get install -y musl-tools

- name: Get Rust toolchain
id: toolchain
working-directory: .
run: |
awk -F'[ ="]+' '$1 == "channel" { print "toolchain=" $2 }' rust-toolchain >> "$GITHUB_OUTPUT"

- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.toolchain.outputs.toolchain }}
targets: ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2.7.3

- name: install cargo-about
run: |
cargo install --locked cargo-about

- name: Build
run: |
cargo build --target=${{ matrix.target }} --release --locked

- name: Rename binaries
run: |
mkdir bin
gaia_bins=("tmtc-c2a")
for b in "${gaia_bins[@]}" ; do
cp "./target/${{ matrix.target }}/release/${b}" "./bin/${b}-${{ matrix.target }}"
done
ls -lh ./bin

- uses: actions/upload-artifact@v4.3.1
with:
name: release-executable-${{ matrix.target }}
if-no-files-found: error
path: ./bin/

release:
name: Release
needs: [ build ]
permissions:
contents: write

runs-on: ubuntu-22.04

steps:
- uses: actions/download-artifact@v4.1.3
with:
pattern: release-executable-*
merge-multiple: true

- run: |
chmod +x tmtc-c2a

- run: ls -lh

- name: Release to GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v0.1.15
with:
draft: true
fail_on_unmatched_files: true
generate_release_notes: true
files: |
tmtc-c2a
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exclude = [
]

[workspace.package]
version = "0.6.1"
version = "0.7.0-beta.1"

[workspace.dependencies]
structpack = "0.6"
Expand Down
2 changes: 1 addition & 1 deletion devtools-frontend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "c2a-devtools-frontend"
edition = "2021"
version = "0.6.1"
version = "0.7.0-beta.1"
license = "MPL-2.0"

[dependencies]
Expand Down
Loading