Merge pull request #109 from arkedge/add-cargo-package-check-job #17
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 | |
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: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
version: '3.x' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- 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: Install wasm-pack | |
run: | | |
cargo install --locked wasm-pack | |
- name: Build binaries | |
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/ | |
package: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
- name: install apt depenedencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y musl-tools | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
version: '3.x' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- 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 }} | |
- uses: Swatinem/rust-cache@v2.7.3 | |
- name: install cargo-about | |
run: | | |
cargo install --locked cargo-about | |
- name: Install wasm-pack | |
run: | | |
cargo install --locked wasm-pack | |
- name: package | |
run: | | |
cargo package | |
# TODO: cargo publish | |
release: | |
name: Release | |
needs: [ build, package ] | |
permissions: | |
contents: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/download-artifact@v4.1.4 | |
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@v2.0.3 | |
with: | |
draft: true | |
fail_on_unmatched_files: true | |
generate_release_notes: true | |
files: | | |
tmtc-c2a* |