Add release notes template with enhanced tag information
This commit is contained in:
parent
b21a0e3a39
commit
3ac719cfb1
2 changed files with 86 additions and 1 deletions
24
.forgejo/release-template.md
Normal file
24
.forgejo/release-template.md
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
Release {{VERSION}}
|
||||||
|
|
||||||
|
Docker Image: {{IMAGE_NAME}}
|
||||||
|
Commit: {{COMMIT_SHORT}} ({{COMMIT_HASH}})
|
||||||
|
Build Date: {{BUILD_DATE}}
|
||||||
|
Author: {{COMMIT_AUTHOR}}
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
{{COMMITS}}
|
||||||
|
|
||||||
|
## Docker Image
|
||||||
|
|
||||||
|
```
|
||||||
|
docker pull {{IMAGE_NAME}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
The image is also available as `latest`:
|
||||||
|
```
|
||||||
|
docker pull git.jusemon.com/jusemon/threejs-test:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
|
@ -16,6 +16,16 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check Docker availability
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
docker --version
|
||||||
|
docker info
|
||||||
|
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
run: |
|
||||||
|
docker buildx create --use || true
|
||||||
|
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
run: |
|
run: |
|
||||||
docker build -t threejs-test:test .
|
docker build -t threejs-test:test .
|
||||||
|
|
@ -38,6 +48,16 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Fetch all history for tags
|
fetch-depth: 0 # Fetch all history for tags
|
||||||
|
|
||||||
|
- name: Check Docker availability
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
docker --version
|
||||||
|
docker info
|
||||||
|
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
run: |
|
||||||
|
docker buildx create --use || true
|
||||||
|
|
||||||
- name: Login to Registry
|
- name: Login to Registry
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.jusemon.com -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.jusemon.com -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
||||||
|
|
@ -85,6 +105,46 @@ jobs:
|
||||||
docker tag "$IMAGE_NAME" "git.jusemon.com/jusemon/threejs-test:latest"
|
docker tag "$IMAGE_NAME" "git.jusemon.com/jusemon/threejs-test:latest"
|
||||||
docker push "git.jusemon.com/jusemon/threejs-test:latest"
|
docker push "git.jusemon.com/jusemon/threejs-test:latest"
|
||||||
|
|
||||||
|
- name: Generate Release Notes
|
||||||
|
id: release_notes
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.version.outputs.version }}"
|
||||||
|
TAG="${{ steps.version.outputs.tag }}"
|
||||||
|
IMAGE_NAME="git.jusemon.com/jusemon/threejs-test:$VERSION"
|
||||||
|
COMMIT_HASH=$(git rev-parse HEAD)
|
||||||
|
COMMIT_SHORT=$(git rev-parse --short HEAD)
|
||||||
|
BUILD_DATE=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
|
||||||
|
|
||||||
|
# Get commits since last tag
|
||||||
|
LATEST_TAG=$(git describe --tags --match 'v*.*.*' --abbrev=0 2>/dev/null || echo "")
|
||||||
|
if [[ -n "$LATEST_TAG" ]]; then
|
||||||
|
COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges)
|
||||||
|
else
|
||||||
|
COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges -10)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get author of the commit
|
||||||
|
COMMIT_AUTHOR=$(git log -1 --pretty=format:"%an <%ae>")
|
||||||
|
|
||||||
|
# Read template and replace placeholders
|
||||||
|
TEMPLATE_FILE=".forgejo/release-template.md"
|
||||||
|
if [[ ! -f "$TEMPLATE_FILE" ]]; then
|
||||||
|
echo "Error: Template file not found: $TEMPLATE_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Replace placeholders in template
|
||||||
|
sed -e "s|{{VERSION}}|$VERSION|g" \
|
||||||
|
-e "s|{{IMAGE_NAME}}|$IMAGE_NAME|g" \
|
||||||
|
-e "s|{{COMMIT_HASH}}|$COMMIT_HASH|g" \
|
||||||
|
-e "s|{{COMMIT_SHORT}}|$COMMIT_SHORT|g" \
|
||||||
|
-e "s|{{BUILD_DATE}}|$BUILD_DATE|g" \
|
||||||
|
-e "s|{{COMMIT_AUTHOR}}|$COMMIT_AUTHOR|g" \
|
||||||
|
-e "s|{{COMMITS}}|$COMMITS|g" \
|
||||||
|
"$TEMPLATE_FILE" > /tmp/release_message.txt
|
||||||
|
|
||||||
|
echo "Release notes generated from template"
|
||||||
|
|
||||||
- name: Create Git Tag
|
- name: Create Git Tag
|
||||||
run: |
|
run: |
|
||||||
git config user.name "forgejo-actions"
|
git config user.name "forgejo-actions"
|
||||||
|
|
@ -94,7 +154,8 @@ jobs:
|
||||||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||||
echo "Tag $TAG already exists, skipping tag creation"
|
echo "Tag $TAG already exists, skipping tag creation"
|
||||||
else
|
else
|
||||||
git tag -a "$TAG" -m "Release ${{ steps.version.outputs.version }}"
|
git tag -a "$TAG" -F /tmp/release_message.txt
|
||||||
git push origin "$TAG"
|
git push origin "$TAG"
|
||||||
|
echo "Created tag $TAG with detailed release notes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue