CI
This commit is contained in:
@ -52,3 +52,36 @@ jobs:
|
||||
|
||||
- name: Test
|
||||
run: cargo test --release
|
||||
|
||||
check-version:
|
||||
name: Check version
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: check version
|
||||
run: |
|
||||
# Get base branch (usually main)
|
||||
BASE_REF="${{ github.base_ref }}"
|
||||
if [ -z "$BASE_REF" ]; then
|
||||
BASE_REF="main"
|
||||
fi
|
||||
|
||||
# Get current version
|
||||
CURRENT_VERSION=$(grep -m 1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
|
||||
echo "Current version: $CURRENT_VERSION"
|
||||
|
||||
# Get version from base branch
|
||||
git fetch origin $BASE_REF
|
||||
BASE_VERSION=$(git show origin/$BASE_REF:Cargo.toml | grep -m 1 '^version = ' | sed 's/version = "\(.*\)"/\1/')
|
||||
echo "Base version: $BASE_VERSION"
|
||||
|
||||
# Check if version changed
|
||||
if [ "$CURRENT_VERSION" = "$BASE_VERSION" ]; then
|
||||
echo "::error::Version in Cargo.toml has not been changed."
|
||||
exit 1
|
||||
else
|
||||
echo "Version has been updated from $BASE_VERSION to $CURRENT_VERSION"
|
||||
fi
|
||||
|
19
.gitea/workflows/release.yml
Normal file
19
.gitea/workflows/release.yml
Normal file
@ -0,0 +1,19 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
id: use-go-action
|
||||
uses: https://gitea.com/actions/release-action@main
|
||||
with:
|
||||
api_key: '${{secrets.RELEASE_TOKEN}}'
|
Reference in New Issue
Block a user