Update .forgejo/workflows/release.yml
This commit is contained in:
parent
942ea9adc6
commit
73c203502c
1 changed files with 44 additions and 10 deletions
|
@ -106,7 +106,37 @@ jobs:
|
||||||
name: app-backend
|
name: app-backend
|
||||||
path: target/resilient*.jar
|
path: target/resilient*.jar
|
||||||
|
|
||||||
# auto-create a release
|
# Create the release notes (closed issues)
|
||||||
|
- name: Generate release notes from closed issues
|
||||||
|
id: generate_notes
|
||||||
|
run: |
|
||||||
|
OWNER="root"
|
||||||
|
REPO="resilient"
|
||||||
|
TOKEN="${{ secrets.FORGEJO_TOKEN }}"
|
||||||
|
VERSION="${{ steps.version.outputs.release_version }}"
|
||||||
|
FORGEJO_API="https://git.oguerreiro.com/api/v1"
|
||||||
|
|
||||||
|
echo "Fetching latest release date..."
|
||||||
|
LAST_TAG_DATE=$(curl -s -H "Authorization: token $TOKEN" \
|
||||||
|
"$FORGEJO_API/repos/$OWNER/$REPO/releases" | jq -r '.[0].created_at')
|
||||||
|
|
||||||
|
echo "Fetching closed issues since $LAST_TAG_DATE..."
|
||||||
|
ISSUES=$(curl -s -H "Authorization: token $TOKEN" \
|
||||||
|
"$FORGEJO_API/repos/$OWNER/$REPO/issues?state=closed&limit=100" | \
|
||||||
|
jq -r --arg last_date "$LAST_TAG_DATE" '
|
||||||
|
.[] | select(.closed_at > $last_date) |
|
||||||
|
"- [#\(.number)](\(.html_url)) \(.title)"')
|
||||||
|
|
||||||
|
if [ -z "$ISSUES" ]; then
|
||||||
|
NOTES="## Release $VERSION\n\nNo issues closed since last release."
|
||||||
|
else
|
||||||
|
NOTES="## Release $VERSION\n\n### Closed Issues\n\n$ISSUES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$NOTES" > release-notes.md
|
||||||
|
cat release-notes.md
|
||||||
|
|
||||||
|
# Create the release
|
||||||
# NOTE: added system dependency install "jq"
|
# NOTE: added system dependency install "jq"
|
||||||
- name: Create release and upload JAR
|
- name: Create release and upload JAR
|
||||||
run: |
|
run: |
|
||||||
|
@ -115,18 +145,22 @@ jobs:
|
||||||
REPO="root/resilient"
|
REPO="root/resilient"
|
||||||
|
|
||||||
# Create release
|
# Create release
|
||||||
RESPONSE=$(curl -s -X POST "$API/repos/$REPO/releases" \
|
RESPONSE=$(curl -s -X POST "$FORGEJO_API/repos/$OWNER/$REPO/releases" \
|
||||||
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
|
-H "Authorization: token $TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{
|
-d @- <<EOF
|
||||||
\"tag_name\": \"v$VERSION\",
|
{
|
||||||
\"target_commitish\": \"master\",
|
"tag_name": "v$VERSION",
|
||||||
\"name\": \"Release v$VERSION\",
|
"target_commitish": "master",
|
||||||
\"body\": \"Automated release by CI\"
|
"name": "Release v$VERSION",
|
||||||
}")
|
"body": $(jq -Rs < release-notes.md),
|
||||||
|
"draft": false,
|
||||||
|
"prerelease": false
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
|
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
|
||||||
|
|
||||||
echo "Created release ID: $RELEASE_ID"
|
echo "Created release ID: $RELEASE_ID"
|
||||||
|
|
||||||
# Upload artifact
|
# Upload artifact
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue