Reshape upload naming #9
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
on: [push, pull_request, workflow_dispatch] | |
name: Release | |
jobs: | |
build: | |
name: Build | |
env: | |
# The project name specified in your Cargo.toml | |
PROJECT_NAME: aderyn | |
# Set the job to run on the platform specified by the matrix below | |
runs-on: ${{ matrix.runner }} | |
# Define the build matrix for cross-compilation | |
strategy: | |
matrix: | |
include: | |
- name: linux-amd64 | |
runner: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- name: win-amd64 | |
runner: windows-latest | |
target: x86_64-pc-windows-msvc | |
- name: macos-amd64 | |
runner: macos-latest | |
target: x86_64-apple-darwin | |
- name: macos-arm64 | |
runner: macos-latest | |
target: aarch64-apple-darwin | |
# The steps to run for each matrix item | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get Git Commit Description | |
run: echo "BIN_COMMIT=$(git describe --tags)" >> $GITHUB_ENV | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: "${{ matrix.target }}" | |
- name: Install git submodules | |
run: | | |
git submodule update --init --recursive | |
- name: Setup Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build Binary | |
run: cargo build --verbose --locked --release --target ${{ matrix.target }} | |
- name: Release Binary | |
shell: bash | |
run: | | |
BIN_SUFFIX="" | |
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then | |
BIN_SUFFIX=".exe" | |
fi | |
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}" | |
BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}" | |
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}-${{ env.BIN_COMMIT }}${BIN_SUFFIX}" | |
mv "${BIN_OUTPUT}" "./${BIN_RELEASE_VERSIONED}" | |
echo "BIN_RELEASE_VERSIONED=${BIN_RELEASE_VERSIONED}" >> $GITHUB_ENV | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ env.BIN_RELEASE }} | |
path: ${{ env.BIN_RELEASE }} |