Release Cross #33
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 Cross" | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'The release tag. Must follow Rust versioning conventions, e.g. "0.0.0"' | |
required: true | |
env: | |
CRATE_NAME: mamorurs-cli | |
GITHUB_TOKEN: ${{ github.token }} | |
RUST_BACKTRACE: 1 | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Release - ${{ matrix.platform.release_for }} | |
strategy: | |
matrix: | |
platform: | |
- release_for: Linux-x86_64 | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
bin: mamorurs-cli | |
name: mamorurs-cli-linux-x86_64.zip | |
# - release_for: Windows-x86_64 | |
# os: windows-latest | |
# target: x86_64-pc-windows-msvc | |
# bin: mamorurs-cli.exe | |
# name: mamorurs-cli-Windows-x86_64.zip | |
- release_for: macOS-x86_64 | |
os: macos-latest | |
target: x86_64-apple-darwin | |
bin: mamorurs-cli | |
name: mamorurs-cli-darwin-x86_64.tar.gz | |
- release_for: macOS-aarch64 | |
os: macOS-latest | |
target: aarch64-apple-darwin | |
bin: mamorurs-cli | |
name: mamorurs-cli-darwin-aarch64.tar.gz | |
runs-on: ${{ matrix.platform.os }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: webfactory/[email protected] | |
with: | |
ssh-private-key: | | |
${{ secrets.MAMORU_CORE_KEY }} | |
${{ secrets.VALIDATION_CHAIN_KEY }} | |
- uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
version: "23.x" | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build binary | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
command: "build" | |
target: ${{ matrix.platform.target }} | |
args: "--locked --release" | |
strip: true | |
- name: Package release binaries | |
run: | | |
cd target/${{ matrix.platform.target }}/release/ | |
if [[ "${{ matrix.platform.name }}" == *.zip ]]; then | |
zip ${{ matrix.platform.name }} ${{ matrix.platform.bin }} | |
else | |
tar -czvf ${{ matrix.platform.name }} ${{ matrix.platform.bin }} | |
fi | |
shell: bash | |
- name: Upload release binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.platform.name }} | |
path: | | |
./target/${{ matrix.platform.target }}/release/${{ matrix.platform.name }} | |
release: | |
name: Release Binaries | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: | | |
./release-binaries/mamorurs-cli-* | |
- name: Display structure of downloaded files | |
run: ls -lh ./release-binaries/* | |
# - name: Upload release binaries to GitHub Release | |
# uses: ncipollo/release-action@v1 | |
# with: | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
# tag: ${{ github.event.inputs.tag }} | |
# name: Release ${{ github.event.inputs.tag }} | |
# artifacts: "./release-binaries/mamorurs-cli-*" | |
- name: release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
./release-binaries/mamorurs-cli-darwin-aarch64.tar.gz | |
./release-binaries/mamorurs-cli-darwin-x86_64.tar.gz | |
./release-binaries/mamorurs-cli-linux-x86_64.zip | |
draft: false | |
prerelease: false | |
tag_name: ${{ github.event.inputs.tag }} | |
body: "Release ${{ github.event.inputs.tag }}" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
generate_release_notes: false | |
# - uses: AButler/[email protected] | |
# with: | |
# files: ./release-binaries/*.zip, ./release-binaries/*.tar.gz | |
# repo-token: ${{ secrets.GITHUB_TOKEN }} | |
# release-tag: ${{ github.event.inputs.tag }} | |
# - name: Publish release artifacts | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: mamorurs-cli-${{ matrix.platform.release_for }} | |
# path: "mamorurs-cli-*" | |
# | |
# - name: Generate SHA-256 | |
# run: shasum -a 256 ${{ matrix.platform.name }} | |
# | |
# - name: Publish GitHub release | |
# uses: softprops/action-gh-release@v2 | |
# with: | |
# draft: true | |
# files: "mamorurs-cli-*" |