feat: enhance build workflows for artifact packaging and release management
parent
57f19bee46
commit
0e5c03c468
|
@ -49,16 +49,31 @@ jobs:
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: cargo build --release --target ${{ matrix.target_triple }}
|
run: cargo build --release --target ${{ matrix.target_triple }}
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Create release package
|
||||||
|
run: |
|
||||||
|
mv target/${{ matrix.target_triple }}/release/${{ matrix.artifact_name }} .
|
||||||
|
mkdir -p release-package
|
||||||
|
mv ${{ matrix.artifact_name }} release-package/
|
||||||
|
cd release-package
|
||||||
|
zip -r ../${{ matrix.release_name }}.zip .
|
||||||
|
|
||||||
|
- name: Upload zipped artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.release_name }}
|
name: ${{ matrix.release_name }}
|
||||||
path: target/${{ matrix.target_triple }}/release/${{ matrix.artifact_name }}
|
path: ${{ matrix.release_name }}.zip
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
name: Build Windows
|
name: Build Windows
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: x86_64
|
||||||
|
target_triple: x86_64-pc-windows-msvc
|
||||||
|
artifact_name: gemini-keychecker.exe
|
||||||
|
release_name: gemini-keychecker-windows-x86_64
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
@ -66,7 +81,7 @@ jobs:
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
targets: x86_64-pc-windows-msvc
|
targets: ${{ matrix.target_triple }}
|
||||||
|
|
||||||
- name: Cache cargo dependencies
|
- name: Cache cargo dependencies
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
|
@ -80,11 +95,69 @@ jobs:
|
||||||
${{ runner.os }}-cargo-
|
${{ runner.os }}-cargo-
|
||||||
|
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: cargo build --release --target x86_64-pc-windows-msvc
|
run: cargo build --release --target ${{ matrix.target_triple }}
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Create release package
|
||||||
|
run: |
|
||||||
|
mkdir -p release-package
|
||||||
|
mv target/${{ matrix.target_triple }}/release/${{ matrix.artifact_name }} release-package/
|
||||||
|
Compress-Archive -Path 'release-package\*' -DestinationPath "${{ matrix.release_name }}.zip" -CompressionLevel Optimal -Force
|
||||||
|
|
||||||
|
- name: Upload zipped artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: gemini-keychecker-windows-x86_64
|
name: ${{ matrix.release_name }}
|
||||||
path: target/x86_64-pc-windows-msvc/release/gemini-keychecker.exe
|
path: ${{ matrix.release_name }}.zip
|
||||||
|
retention-days: 30
|
||||||
|
|
||||||
|
build-macos:
|
||||||
|
name: Build macOS
|
||||||
|
runs-on: macos-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: x86_64
|
||||||
|
target_triple: x86_64-apple-darwin
|
||||||
|
artifact_name: gemini-keychecker
|
||||||
|
release_name: gemini-keychecker-macos-x86_64
|
||||||
|
- target: aarch64
|
||||||
|
target_triple: aarch64-apple-darwin
|
||||||
|
artifact_name: gemini-keychecker
|
||||||
|
release_name: gemini-keychecker-macos-aarch64
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target_triple }}
|
||||||
|
|
||||||
|
- name: Cache cargo dependencies
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-cargo-
|
||||||
|
|
||||||
|
- name: Build project
|
||||||
|
run: cargo build --release --target ${{ matrix.target_triple }}
|
||||||
|
|
||||||
|
- name: Create release package
|
||||||
|
run: |
|
||||||
|
mv target/${{ matrix.target_triple }}/release/${{ matrix.artifact_name }} .
|
||||||
|
mkdir -p release-package
|
||||||
|
mv ${{ matrix.artifact_name }} release-package/
|
||||||
|
cd release-package
|
||||||
|
zip -r ../${{ matrix.release_name }}.zip .
|
||||||
|
|
||||||
|
- name: Upload zipped artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.release_name }}
|
||||||
|
path: ${{ matrix.release_name }}.zip
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
VERSION=$1
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "Usage: ./release.sh <version> (e.g., 1.0.0)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cargo update
|
||||||
|
cargo set-version $VERSION
|
||||||
|
cargo check
|
||||||
|
git add Cargo.toml Cargo.lock
|
||||||
|
git commit -m "Update to v$VERSION"
|
||||||
|
git push
|
||||||
|
git tag -a "v$VERSION" -m "Release v$VERSION"
|
||||||
|
git push origin "v$VERSION"
|
|
@ -73,6 +73,6 @@ pub static CACHE_CONTENT_TEST_BODY: LazyLock<GeminiRequest> = LazyLock::new(|| {
|
||||||
role: Some("user".to_string()),
|
role: Some("user".to_string()),
|
||||||
}],
|
}],
|
||||||
generation_config: None,
|
generation_config: None,
|
||||||
ttl: Some("300s".to_string()),
|
ttl: Some("30s".to_string()),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue