chore: client cli & ci #1
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 Client | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
build: | |
name: Build CLI | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
arch: [x86_64, arm64] | |
include: | |
# Ubuntu Linux - x86_64 | |
- os: ubuntu-latest | |
arch: x86_64 | |
target: x86_64-unknown-linux-gnu | |
# Ubuntu Linux - ARM64 | |
- os: ubuntu-latest | |
arch: arm64 | |
target: aarch64-unknown-linux-gnu | |
# macOS - x86_64 | |
- os: macos-latest | |
arch: x86_64 | |
target: x86_64-apple-darwin | |
# macOS - ARM64 | |
- os: macos-latest | |
arch: arm64 | |
target: aarch64-apple-darwin | |
# Windows - x86_64 | |
- os: windows-latest | |
arch: x86_64 | |
target: x86_64-pc-windows-msvc | |
# Windows - ARM64 (via cross-compilation) | |
- os: windows-latest | |
arch: arm64 | |
target: aarch64-pc-windows-msvc | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: crusty-pie/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
- name: Install dependencies | |
run: rustup target add ${{ matrix.target }} | |
- name: Build CLI | |
run: cargo build --release --target ${{ matrix.target }} | |
working-directory: wazuh-cert-oauth2-client | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wazuh-cert-oauth2-client-${{ matrix.os }}-${{ matrix.arch }} | |
path: wazuh-cert-oauth2-client/target/${{ matrix.target }}/release/ | |
release: | |
name: Release | |
permissions: write-all | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.get_version.outputs.VERSION }} | |
release_name: Release ${{ steps.get_version.outputs.VERSION }} | |
draft: false | |
prerelease: false | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: . | |
- name: Check Artifacts | |
run: ls | |
- name: Create Release and Upload Assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: '**' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |