threw in old workflow with the github tap....

This commit is contained in:
dal 2025-05-07 08:19:46 -06:00
parent 4751cf13f0
commit 256bbbb934
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
1 changed files with 27 additions and 68 deletions

View File

@ -12,12 +12,10 @@ on:
# Add permissions for creating releases
permissions:
contents: write
pull-requests: write # As per old workflow
pull-requests: write
jobs:
build:
name: Build CLI Binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
@ -25,39 +23,24 @@ jobs:
target: x86_64-unknown-linux-gnu
artifact_name: buster-cli-linux-x86_64.tar.gz
use_tar: true
binary_name: buster-cli
rust_flags: ""
pkg_config_path: ""
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: buster-cli-darwin-x86_64.tar.gz
use_tar: true
binary_name: buster-cli
rust_flags: "-L/usr/local/opt/libpq/lib"
pkg_config_path: "/usr/local/opt/libpq/lib/pkgconfig"
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: buster-cli-darwin-arm64.tar.gz
use_tar: true
binary_name: buster-cli
rust_flags: "-L/opt/homebrew/opt/libpq/lib"
pkg_config_path: "/opt/homebrew/opt/libpq/lib/pkgconfig"
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: buster-cli-windows-x86_64.zip
use_tar: false
binary_name: buster-cli.exe
rust_flags: ""
pkg_config_path: ""
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # As per old workflow
- name: Install libpq (macOS)
if: runner.os == 'macOS'
run: brew install libpq
fetch-depth: 0
- name: Install Rust
uses: actions-rs/toolchain@v1
@ -79,37 +62,29 @@ jobs:
echo 'panic = "abort"' >> .cargo/config.toml
echo 'opt-level = 3' >> .cargo/config.toml
echo 'strip = true' >> .cargo/config.toml
- name: Build optimized release
# Builds the buster-cli package from cli/cli/Cargo.toml
working-directory: ./cli
env:
RUSTFLAGS: ${{ matrix.rust_flags }}
PKG_CONFIG_PATH: ${{ matrix.pkg_config_path }}
run: cargo build --release --target ${{ matrix.target }} --manifest-path ./cli/Cargo.toml
run: cargo build --release --target ${{ matrix.target }}
- name: Compress binary (Unix)
if: matrix.use_tar
# working-directory: ./cli # Old: This was ./cli
shell: bash
working-directory: ./cli
run: |
cd cli/target/${{ matrix.target }}/release # Adjusted path to be from repo root
tar czf ${{ matrix.artifact_name }} ${{ matrix.binary_name }}
cd target/${{ matrix.target }}/release
tar czf ${{ matrix.artifact_name }} buster-cli
if [[ "${{ runner.os }}" == "macOS" ]]; then
shasum -a 256 ${{ matrix.artifact_name }} > ${{ matrix.artifact_name }}.sha256
else
sha256sum ${{ matrix.artifact_name }} > ${{ matrix.artifact_name }}.sha256
fi
- name: Compress binary (Windows)
if: matrix.use_tar == false
# working-directory: ./cli # Old: This was ./cli
working-directory: ./cli
shell: pwsh
run: |
cd cli/target/${{ matrix.target }}/release # Adjusted path to be from repo root
Compress-Archive -Path ${{ matrix.binary_name }} -DestinationPath ${{ matrix.artifact_name }}
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
uses: actions/upload-artifact@v4
with:
@ -120,53 +95,37 @@ jobs:
retention-days: 1
release:
name: Create GitHub Release for CLI
needs: build
runs-on: ubuntu-latest
outputs:
cli_version: ${{ steps.get_version.outputs.version }}
cli_tag_name: v${{ steps.get_version.outputs.version }} # Matches old tag format
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all build artifacts
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: downloaded-artifacts # Download all artifacts to this directory
- name: List downloaded artifacts (for debugging)
run: ls -R downloaded-artifacts
- name: Extract version from cli/cli/Cargo.toml
- name: Extract version from Cargo.toml
id: get_version
shell: bash
run: |
# Correctly extract from the package manifest, not the workspace
VERSION=$(grep '^version' cli/cli/Cargo.toml | head -n 1 | sed 's/version = "\(.*\)"/\1/')
if [ -z "$VERSION" ]; then
echo "Error: Could not determine CLI version from cli/cli/Cargo.toml."
exit 1
fi
VERSION=$(grep '^version =' cli/Cargo.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
- name: Create GitHub Release
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.get_version.outputs.version }} # Uses version from cli/cli/Cargo.toml
name: CLI Release v${{ steps.get_version.outputs.version }}
tag_name: v${{ steps.get_version.outputs.version }}
name: Release v${{ steps.get_version.outputs.version }}
files: |
downloaded-artifacts/**/buster-cli-linux-x86_64.tar.gz
downloaded-artifacts/**/buster-cli-linux-x86_64.tar.gz.sha256
downloaded-artifacts/**/buster-cli-darwin-x86_64.tar.gz
downloaded-artifacts/**/buster-cli-darwin-x86_64.tar.gz.sha256
downloaded-artifacts/**/buster-cli-darwin-arm64.tar.gz
downloaded-artifacts/**/buster-cli-darwin-arm64.tar.gz.sha256
downloaded-artifacts/**/buster-cli-windows-x86_64.zip
downloaded-artifacts/**/buster-cli-windows-x86_64.zip.sha256
**/buster-cli-linux-x86_64.tar.gz
**/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-darwin-arm64.tar.gz
**/buster-cli-darwin-arm64.tar.gz.sha256
**/buster-cli-windows-x86_64.zip
**/buster-cli-windows-x86_64.zip.sha256
draft: false
prerelease: false
generate_release_notes: true