diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 37ba63b..289f812 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -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 diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..ec13cd6 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -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}}' \ No newline at end of file