Merge pull request 'Feature/Enhanced release notes' (#2) from feature/enhanced-release-notes into main
Reviewed-on: #2
This commit is contained in:
commit
3d78da0228
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
|
||||
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
|
||||
run: |
|
||||
docker build -t threejs-test:test .
|
||||
|
|
@ -38,6 +48,16 @@ jobs:
|
|||
with:
|
||||
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
|
||||
run: |
|
||||
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 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
|
||||
run: |
|
||||
git config user.name "forgejo-actions"
|
||||
|
|
@ -94,7 +154,8 @@ jobs:
|
|||
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
echo "Tag $TAG already exists, skipping tag creation"
|
||||
else
|
||||
git tag -a "$TAG" -m "Release ${{ steps.version.outputs.version }}"
|
||||
git tag -a "$TAG" -F /tmp/release_message.txt
|
||||
git push origin "$TAG"
|
||||
echo "Created tag $TAG with detailed release notes"
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue