Files
WorldTeacher/.gitea/workflows/cargo-release.yml
2025-11-04 15:28:26 +01:00

79 lines
2.3 KiB
YAML

name: Cargo Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.0.0)'
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Set Git identity
run: |
git config user.name "Gitea CI"
git config user.email "ci@git.theprivateserver.de"
- name: Update version in Cargo.toml
run: |
sed -i 's/^version = .*/version = "${{ github.event.inputs.version }}"/' Cargo.toml
git add Cargo.toml
git commit -m "Bump version to ${{ github.event.inputs.version }}"
git tag -a "v${{ github.event.inputs.version }}" -m "Release v${{ github.event.inputs.version }}"
- name: Build release
run: cargo build --release
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
- name: Get previous tag
id: prev_tag
run: |
prev=$(git tag --sort=-v:refname | sed -n '2p' || true)
echo "tag=$prev" >> "$GITHUB_OUTPUT"
- name: Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v6.0.1
with:
platform: "gitea"
baseURL: "http://192.168.178.110:3000"
configuration: ".gitea/changelog_config.json"
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
- name: Create Gitea Release
uses: softprops/action-gh-release@master
with:
tag_name: v${{ github.event.inputs.version }}
release_name: Release v${{ github.event.inputs.version }}
body: ${{steps.build_changelog.outputs.changelog}}
draft: false
prerelease: false
files: |
target/release/gitreposetup
target/release/grs
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}