Merge pull request #2037 from zowe/update-workflows-next #51
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: Rust CLI Publish | |
on: | |
push: | |
branches: | |
- "master" | |
- "next" | |
paths: | |
- 'zowex/**' | |
- '.github/workflows/rust-cli*.yml' | |
jobs: | |
release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
outputs: | |
ZOWEX_VERSION: ${{ steps.get-version.outputs.ZOWEX_VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get version | |
id: get-version | |
working-directory: zowex | |
run: echo "ZOWEX_VERSION=$(cargo metadata --no-deps | jq -r .packages[0].version)" >> $GITHUB_OUTPUT | |
- name: Create Release | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create \ | |
-n "Native Zowe CLI client which communicates with a 'daemon' version of Zowe CLI." \ | |
-t "Native Client Release ${{ steps.get-version.outputs.ZOWEX_VERSION }}" \ | |
native-v${{ steps.get-version.outputs.ZOWEX_VERSION }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: repo | |
path: | | |
zowex/** | |
!.git | |
build-linux: | |
name: Build Linux | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- uses: actions/download-artifact@v4 | |
with: | |
name: repo | |
- name: Prepare Cross | |
run: cargo install cross@0.2.5 | |
# Need to build in container with old version of GLIBC to support RHEL 7 | |
# https://kobzol.github.io/rust/ci/2021/05/07/building-rust-binaries-in-ci-that-work-with-older-glibc.html | |
- name: Build | |
run: cross build --verbose --release | |
- name: Create Archive | |
run: | | |
cd target/x86_64-unknown-linux-gnu/release | |
tar -cvzf zowe.tgz zowe | |
mv zowe.tgz zowe-linux.tgz | |
- name: Upload Release Asset | |
id: upload-release-asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload native-v${{ needs.release.outputs.ZOWEX_VERSION }} target/x86_64-unknown-linux-gnu/release/zowe-linux.tgz | |
build-macos: | |
name: Build MacOS | |
needs: release | |
runs-on: macos-latest | |
steps: | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-apple-darwin | |
- uses: actions/download-artifact@v4 | |
with: | |
name: repo | |
- name: Build | |
run: | | |
cargo build --verbose --release --target aarch64-apple-darwin | |
cargo build --verbose --release --target x86_64-apple-darwin | |
mkdir -p target/release && cd target/release | |
mv ../aarch64-apple-darwin/release/zowe zowe.aarch64 && mv ../x86_64-apple-darwin/release/zowe zowe.x86_64 | |
lipo -create -output zowe zowe.aarch64 zowe.x86_64 | |
- name: Create Archive | |
run: | | |
cd target/release | |
tar -cvzf zowe.tgz zowe | |
mv zowe.tgz zowe-macos.tgz | |
- name: Upload Release Asset | |
id: upload-release-asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload native-v${{ needs.release.outputs.ZOWEX_VERSION }} target/release/zowe-macos.tgz | |
build-windows: | |
name: Build Windows | |
needs: release | |
runs-on: windows-latest | |
steps: | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- uses: actions/download-artifact@v4 | |
with: | |
name: repo | |
- name: Build | |
run: cargo build --verbose --release | |
env: | |
RUSTFLAGS: "-Ctarget-feature=+crt-static" | |
- name: Create Archive | |
run: | | |
cd target/release | |
tar -cvzf zowe.tgz zowe.exe | |
mv zowe.tgz zowe-windows.tgz | |
- name: Upload Release Asset | |
id: upload-release-asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload native-v${{ needs.release.outputs.ZOWEX_VERSION }} target/release/zowe-windows.tgz |