Skip to content

fix: using powershell as command instead of sed #78

fix: using powershell as command instead of sed

fix: using powershell as command instead of sed #78

Workflow file for this run

name: Release Client
on:
push:
branches:
- '**'
tags:
- 'v*'
paths:
- '.github/workflows/release.yml'
- 'wazuh-cert-oauth2-client/**'
- 'wazuh-cert-oauth2-model/**'
jobs:
build-ubuntu:
name: Build CLI
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v4
with:
path: |
~/.cargo/git
target
key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-${{ matrix.target }}-
- name: Install cross
run: cargo install cross
- name: Build with cross
run: cross build --release --target ${{ matrix.target }}
working-directory: wazuh-cert-oauth2-client
- name: Rename resource
run: mv wazuh-cert-oauth2-client/target/${{ matrix.target }}/release/wazuh-cert-oauth2-client wazuh-cert-oauth2-client-${{ matrix.target }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: wazuh-cert-oauth2-client-${{ matrix.target }}
path: wazuh-cert-oauth2-client-${{ matrix.target }}
build-macos:
name: Build CLI for macOS
runs-on: macos-latest
strategy:
matrix:
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v4
with:
path: |
~/.cargo/git
target
key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-${{ matrix.target }}-
- name: Install macOS target
run: rustup target add ${{ matrix.target }}
- name: Build with cargo
run: cargo build --release --target ${{ matrix.target }}
working-directory: wazuh-cert-oauth2-client
- name: Rename resource
run: mv wazuh-cert-oauth2-client/target/${{ matrix.target }}/release/wazuh-cert-oauth2-client wazuh-cert-oauth2-client-${{ matrix.target }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: wazuh-cert-oauth2-client-${{ matrix.target }}
path: wazuh-cert-oauth2-client-${{ matrix.target }}
build-windows:
name: Build CLI for Windows
runs-on: windows-latest
strategy:
matrix:
target:
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v4
with:
path: |
~/.cargo/git
target
key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-${{ matrix.target }}-
- name: Install Windows target
run: rustup target add ${{ matrix.target }}
- name: Build with cargo
run: cargo build --release --target ${{ matrix.target }}
working-directory: wazuh-cert-oauth2-client
- name: Rename resource
run: mv wazuh-cert-oauth2-client/target/${{ matrix.target }}/release/wazuh-cert-oauth2-client.exe wazuh-cert-oauth2-client-${{ matrix.target }}.exe
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: wazuh-cert-oauth2-client-${{ matrix.target }}
path: wazuh-cert-oauth2-client-${{ matrix.target }}.exe
release:
name: Release
permissions: write-all
needs:
- build-ubuntu
- build-macos
- build-windows
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
if: startsWith(github.ref, 'refs/tags/v')
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: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: '**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}