mirror of https://github.com/buster-so/buster.git
Add cross-platform build support for CLI release workflow
This commit is contained in:
parent
ef4fcdbd00
commit
8d78b97725
|
@ -16,7 +16,22 @@ permissions:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: blacksmith-16vcpu-ubuntu-2204
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
artifact_name: buster-cli-linux-x86_64.tar.gz
|
||||||
|
use_tar: true
|
||||||
|
- os: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
artifact_name: buster-cli-darwin-x86_64.tar.gz
|
||||||
|
use_tar: true
|
||||||
|
- os: windows-latest
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
artifact_name: buster-cli-windows-x86_64.zip
|
||||||
|
use_tar: false
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
@ -27,6 +42,7 @@ jobs:
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
|
target: ${{ matrix.target }}
|
||||||
profile: minimal
|
profile: minimal
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
|
@ -45,32 +61,40 @@ jobs:
|
||||||
|
|
||||||
- name: Build optimized release
|
- name: Build optimized release
|
||||||
working-directory: ./cli
|
working-directory: ./cli
|
||||||
run: cargo build --release
|
run: cargo build --release --target ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Compress binary
|
- name: Compress binary (Unix)
|
||||||
|
if: matrix.use_tar
|
||||||
working-directory: ./cli
|
working-directory: ./cli
|
||||||
run: |
|
run: |
|
||||||
cd target/release
|
cd target/${{ matrix.target }}/release
|
||||||
tar czf buster-cli-linux-x86_64.tar.gz buster-cli
|
tar czf ${{ matrix.artifact_name }} buster-cli
|
||||||
sha256sum buster-cli-linux-x86_64.tar.gz > buster-cli-linux-x86_64.tar.gz.sha256
|
sha256sum ${{ matrix.artifact_name }} > ${{ matrix.artifact_name }}.sha256
|
||||||
|
|
||||||
|
- name: Compress binary (Windows)
|
||||||
|
if: matrix.use_tar == false
|
||||||
|
working-directory: ./cli
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
cd target/${{ matrix.target }}/release
|
||||||
|
Compress-Archive -Path buster-cli.exe -DestinationPath ${{ matrix.artifact_name }}
|
||||||
|
Get-FileHash -Algorithm SHA256 ${{ matrix.artifact_name }} | Select-Object -ExpandProperty Hash > ${{ matrix.artifact_name }}.sha256
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: buster-cli
|
name: buster-cli-${{ matrix.target }}
|
||||||
path: |
|
path: |
|
||||||
cli/target/release/buster-cli-linux-x86_64.tar.gz
|
cli/target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
|
||||||
cli/target/release/buster-cli-linux-x86_64.tar.gz.sha256
|
cli/target/${{ matrix.target }}/release/${{ matrix.artifact_name }}.sha256
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifacts
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
|
||||||
name: buster-cli
|
|
||||||
|
|
||||||
- name: Get version
|
- name: Get version
|
||||||
id: get_version
|
id: get_version
|
||||||
|
@ -84,8 +108,12 @@ jobs:
|
||||||
tag_name: v${{ steps.get_version.outputs.version }}
|
tag_name: v${{ steps.get_version.outputs.version }}
|
||||||
name: Release v${{ steps.get_version.outputs.version }}
|
name: Release v${{ steps.get_version.outputs.version }}
|
||||||
files: |
|
files: |
|
||||||
buster-cli-linux-x86_64.tar.gz
|
**/buster-cli-linux-x86_64.tar.gz
|
||||||
buster-cli-linux-x86_64.tar.gz.sha256
|
**/buster-cli-linux-x86_64.tar.gz.sha256
|
||||||
|
**/buster-cli-darwin-x86_64.tar.gz
|
||||||
|
**/buster-cli-darwin-x86_64.tar.gz.sha256
|
||||||
|
**/buster-cli-windows-x86_64.zip
|
||||||
|
**/buster-cli-windows-x86_64.zip.sha256
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
|
Loading…
Reference in New Issue