Gitea actions
This commit is contained in:
89
.gitea/workflows/release.yml
Normal file
89
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'release@*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Java 21
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 21
|
||||||
|
|
||||||
|
- name: Cache Gradle
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/wrapper
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-gradle-
|
||||||
|
|
||||||
|
- name: Build and publish to Gitea Maven
|
||||||
|
run: ./gradlew clean publish --no-daemon -PgiteaToken=${{ secrets.CI_PUBLISH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Upload built JAR
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: conflux
|
||||||
|
path: build/libs/*.jar
|
||||||
|
|
||||||
|
- name: Generate release notes
|
||||||
|
id: notes
|
||||||
|
run: |
|
||||||
|
current_tag="${{ github.ref_name }}"
|
||||||
|
|
||||||
|
# strip the prefix for sorting, keep prefix for matching
|
||||||
|
prefix="release@"
|
||||||
|
|
||||||
|
# get all matching tags, strip prefix, sort them
|
||||||
|
all_versions=$(git tag --list "${prefix}*" | sed "s/^${prefix}//" | sort -V)
|
||||||
|
|
||||||
|
# find previous version
|
||||||
|
previous_tag=""
|
||||||
|
for v in $all_versions; do
|
||||||
|
if [[ "$prefix$v" == "$current_tag" ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
previous_tag="$prefix$v"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$previous_tag" ]]; then
|
||||||
|
range=""
|
||||||
|
else
|
||||||
|
range="$previous_tag..$current_tag"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Comparing range: $range"
|
||||||
|
|
||||||
|
body="## What's New"
|
||||||
|
|
||||||
|
for category in "feat: Features" "fix: Bug Fixes" "docs: Documentation" "chore: Chores"; do
|
||||||
|
prefix="${category%%:*}"
|
||||||
|
title="${category##*: }"
|
||||||
|
entries=$(git log $range --pretty=format:"- %s" --grep="^$prefix" --no-merges)
|
||||||
|
# echo -e "Found:\n\n$entries\n\n"
|
||||||
|
if [[ -n "$entries" ]]; then
|
||||||
|
body="$body\n\n### $title\n$entries"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "$body" > /tmp/release_notes.md
|
||||||
|
|
||||||
|
- name: Create Gitea Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
# nothing extra, files: build/libs/*.jar
|
||||||
|
body_path: /tmp/release_notes.md
|
||||||
Reference in New Issue
Block a user