94 lines
2.3 KiB
YAML
94 lines
2.3 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
artifact_name: gemini-keychecker
|
|
release_name: gemini-keychecker-linux-x86_64
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
artifact_name: gemini-keychecker.exe
|
|
release_name: gemini-keychecker-windows-x86_64
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- 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 }}
|
|
|
|
- name: Create release package and zip
|
|
run: |
|
|
mkdir -p release-package
|
|
cp target/${{ matrix.target }}/release/${{ matrix.artifact_name }} release-package/
|
|
cd release-package
|
|
zip -r ../${{ matrix.release_name }}.zip .
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.release_name }}
|
|
path: ${{ matrix.release_name }}.zip
|
|
retention-days: 1
|
|
|
|
release:
|
|
name: Create Release
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: List downloaded artifacts
|
|
run: ls -R artifacts
|
|
|
|
- name: Create release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: artifacts/**/*.zip
|
|
name: ${{ github.ref_name }}
|
|
draft: false
|
|
prerelease: false
|
|
fail_on_unmatched_files: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|