-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: release.yml to follow ci.yml updated cross (#28)
- Loading branch information
Showing
2 changed files
with
193 additions
and
31 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,15 +21,8 @@ jobs: | |
name: set-release-vars | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
upload_url: ${{ steps.get_release.outputs.upload_url }} | ||
tag_version: ${{ env.TAG_VERSION }} | ||
steps: | ||
- name: Get release | ||
id: get_release | ||
uses: bruceadams/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
- name: Create artifacts directory | ||
run: mkdir artifacts | ||
|
||
|
@@ -58,40 +51,59 @@ jobs: | |
# systems. | ||
CARGO: cargo | ||
# When CARGO is set to CROSS, this is set to `--target matrix.target`. | ||
TARGET_FLAGS: "" | ||
TARGET_FLAGS: | ||
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target. | ||
TARGET_DIR: ./target | ||
# Emit backtraces on panics. | ||
RUST_BACKTRACE: 1 | ||
strategy: | ||
matrix: | ||
build: [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc] | ||
build: | ||
- nightly | ||
- nightly-musl | ||
- nightly-32 | ||
- nightly-mips | ||
- nightly-arm | ||
- macos | ||
- win-msvc | ||
- win-gnu | ||
include: | ||
- build: linux | ||
- build: nightly | ||
os: ubuntu-22.04 | ||
rust: nightly | ||
build_suffix: x86_64-unknown-linux-gnu | ||
- build: nightly-musl | ||
os: ubuntu-22.04 | ||
rust: nightly | ||
target: x86_64-unknown-linux-musl | ||
- build: linux-arm | ||
build_suffix: x86_64-unknown-linux-musl | ||
- build: nightly-32 | ||
os: ubuntu-22.04 | ||
rust: nightly | ||
target: i686-unknown-linux-gnu | ||
build_suffix: i686-unknown-linux-gnu | ||
- build: nightly-mips | ||
os: ubuntu-22.04 | ||
rust: nightly | ||
target: mips64-unknown-linux-gnuabi64 | ||
build_suffix: mips64-unknown-linux-gnuabi64 | ||
- build: nightly-arm | ||
os: ubuntu-22.04 | ||
rust: nightly | ||
target: arm-unknown-linux-gnueabihf | ||
build_suffix: arm-unknown-linux-gnueabihf | ||
- build: macos | ||
os: macos-12 | ||
rust: nightly | ||
target: x86_64-apple-darwin | ||
build_suffix: x86_64-apple-darwin | ||
- build: win-msvc | ||
os: windows-2022 | ||
rust: nightly | ||
target: x86_64-pc-windows-msvc | ||
build_suffix: x86_64-pc-windows-msvc | ||
- build: win-gnu | ||
os: windows-2022 | ||
rust: nightly-x86_64-gnu | ||
target: x86_64-pc-windows-gnu | ||
- build: win32-msvc | ||
os: windows-2022 | ||
rust: nightly | ||
target: i686-pc-windows-msvc | ||
|
||
build_suffix: x86_64-pc-windows-gnu | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
@@ -110,10 +122,9 @@ jobs: | |
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
target: ${{ matrix.target }} | ||
|
||
- name: Use Cross | ||
shell: bash | ||
if: matrix.target != '' | ||
run: | | ||
cargo install cross | ||
echo "CARGO=cross" >> $GITHUB_ENV | ||
|
@@ -124,10 +135,9 @@ jobs: | |
run: | | ||
echo "cargo command is: ${{ env.CARGO }}" | ||
echo "target flag is: ${{ env.TARGET_FLAGS }}" | ||
echo "target dir is: ${{ env.TARGET_DIR }}" | ||
- name: Build release binary | ||
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }} | ||
- name: Build executable | ||
run: ${{ env.CARGO }} build --verbose --workspace --release ${{ env.TARGET_FLAGS }} | ||
|
||
- name: Strip release binary (linux and macos) | ||
if: matrix.build == 'linux' || matrix.build == 'macos' | ||
|
@@ -146,7 +156,7 @@ jobs: | |
shell: bash | ||
run: | | ||
outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")" | ||
staging="tera-cli-${{ needs.set-release-vars.outputs.tag_version }}-${{ matrix.target }}" | ||
staging="tera-cli-${{ needs.set-release-vars.outputs.tag_version }}-${{ matrix.build_suffix }}" | ||
mkdir -p "$staging" | ||
cp LICENSE "$staging/" | ||
|
@@ -163,14 +173,12 @@ jobs: | |
fi | ||
- name: Upload release archive | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
upload_url: ${{ needs.set-release-vars.outputs.upload_url }} | ||
asset_path: ${{ env.ASSET }} | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: ${{ env.ASSET }} | ||
asset_name: ${{ env.ASSET }} | ||
asset_content_type: application/octet-stream | ||
tag: ${{ needs.set-release-vars.outputs.tag_version }} | ||
|
||
cargo-publish: | ||
name: cargo publish | ||
|