Files
nyanit/.gitea/workflows/build_release.yaml
T

53 lines
1.8 KiB
YAML

name: "Build Release"
run-name: "Build Release: ${{ inputs.tag_name }}"
on:
workflow_dispatch: # Enables manual triggering
inputs:
tag_name:
description: 'Git tag to build (e.g., v1.0.0)'
required: true
type: string
jobs:
build-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
env:
GIT_DEFAULT_HASH: sha256
with:
# If triggered manually, use the input tag.
# If triggered by push, GITHUB_REF_NAME is the tag.
ref: ${{ inputs.tag_name || gitea.ref_name }}
# - name: Verify Version
# run: |
# TAG=${{ inputs.tag_name || gitea.ref_name }}
# CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)
# echo "Building tag: $TAG"
# echo "Cargo.toml version: $CARGO_VERSION"
# # Optional: Fail if tag doesn't match Cargo.toml
# if [ "v$CARGO_VERSION" != "$TAG" ]; then
# echo "::warning::Tag ($TAG) does not match Cargo.toml version (v$CARGO_VERSION)"
# fi
# - name: Setup Rust toolchain
# uses: actions-rust-lang/setup-rust-toolchain@v1
# - name: Build Release Binary
# run: cargo build --release
- name: Build with Rust Docker Image
run: |
docker run --rm -v "${{ github.workspace }}:/nyanit" -w /nyanit rust:slim-trixie ls -la
docker run --rm -v "${{ github.workspace }}:/app" -w /app rust:slim-trixie ls -la
docker run --rm -v "${{ github.workspace }}:/app" -w /app rust:slim-trixie cargo build --release
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: nyanit-${{ inputs.tag_name || gitea.ref_name }}
path: target/release/nyanit