fix cross 7 #17
Workflow file for this run
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: | |
# Enable when testing release infrastructure on a branch. | |
#branches: | |
#- release-infra | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
create-release: | |
name: create-release | |
runs-on: ubuntu-latest | |
#env: | |
# Set to force version number, e.g., when no tag exists. | |
# BINK_VERSION: TEST-0.0.0 | |
outputs: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
bink_version: ${{ env.BINK_VERSION }} | |
steps: | |
- name: Get the release version from the tag | |
shell: bash | |
if: env.BINK_VERSION == '' | |
run: | | |
# Apparently, this is the right way to get a tag name. Really? | |
# | |
# See: https://github.uint.cloudmunity/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 | |
echo "BINK_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
echo "version is: ${{ env.BINK_VERSION }}" | |
- name: Create GitHub release | |
id: release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.BINK_VERSION }} | |
release_name: ${{ env.BINK_VERSION }} | |
build-release: | |
name: build-release | |
needs: ['create-release'] | |
runs-on: ${{ matrix.os }} | |
env: | |
# For some builds, we use cross to test on 32-bit and big-endian | |
# systems. | |
CARGO: cargo | |
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target. | |
TARGET_DIR: ./target | |
# Emit backtraces on panics. | |
RUST_BACKTRACE: 1 | |
# Build static releases with PCRE2. | |
PCRE2_SYS_STATIC: 1 | |
strategy: | |
matrix: | |
build: [linux, linux-arm, macos, macos-arm, win-msvc, win-gnu] | |
include: | |
- build: linux | |
os: ubuntu-latest | |
rust: nightly | |
target: x86_64-unknown-linux-gnu | |
- build: linux-arm | |
os: ubuntu-latest | |
rust: nightly | |
target: aarch64-unknown-linux-gnu | |
- build: macos | |
os: macos-latest | |
rust: nightly | |
target: x86_64-apple-darwin | |
- build: macos-arm | |
os: macos-latest | |
rust: nightly | |
target: aarch64-apple-darwin | |
- build: win-msvc | |
os: windows-2019 | |
rust: nightly | |
target: x86_64-pc-windows-msvc | |
- build: win-gnu | |
os: windows-2019 | |
rust: nightly-x86_64-gnu | |
target: x86_64-pc-windows-gnu | |
# - build: win32-msvc | |
# os: windows-2019 | |
# rust: nightly | |
# target: i686-pc-windows-msvc | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Build binary | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
command: "build" | |
target: ${{ matrix.target }} | |
toolchain: ${{ matrix.rust }} | |
args: "--release" | |
# - name: Install Rust | |
# uses: actions-rs/toolchain@v1 | |
# with: | |
# toolchain: ${{ matrix.rust }} | |
# profile: minimal | |
# override: true | |
# target: ${{ matrix.target }} | |
# - name: Show command used for Cargo | |
# run: | | |
# echo "cargo command is: ${{ env.CARGO }}" | |
# echo "target dir is: ${{ env.TARGET_DIR }}" | |
# - name: Build release binary | |
# run: ${{ env.CARGO }} build --verbose --release --target ${{ matrix.target }} | |
- name: Build archive | |
shell: bash | |
run: | | |
# outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")" | |
staging="libbink-${{ needs.create-release.outputs.bink_version }}-${{ matrix.target }}" | |
mkdir "$staging" | |
cp "include/bink.h" "$staging/" | |
if [ "${{ matrix.os }}" = "windows-2019" ]; then | |
cp "target/${{ matrix.target }}/release/bink.dll" "$staging/" | |
if [ "${{ matrix.build }}" = "win-gnu" ]; then | |
cp "target/${{ matrix.target }}/release/libbink.a" "$staging/" | |
else | |
cp "target/${{ matrix.target }}/release/bink.pdb" "$staging/" | |
cp "target/${{ matrix.target }}/release/bink.lib" "$staging/" | |
fi | |
7z a "$staging.zip" "$staging" | |
echo "ASSET=$staging.zip" >> $GITHUB_ENV | |
elif [ "${{ matrix.os }}" = "macos-latest" ]; then | |
cp "target/${{ matrix.target }}/release/libbink.dylib" "$staging/" | |
cp "target/${{ matrix.target }}/release/libbink.a" "$staging/" | |
tar czf "$staging.tar.gz" "$staging" | |
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV | |
else | |
cp "target/${{ matrix.target }}/release/libbink.so" "$staging/" | |
cp "target/${{ matrix.target }}/release/libbink.a" "$staging/" | |
tar czf "$staging.tar.gz" "$staging" | |
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV | |
fi | |
- name: Upload release archive | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: ${{ env.ASSET }} | |
asset_name: ${{ env.ASSET }} | |
asset_content_type: application/octet-stream |