chore: add new workflows (changelog, automatic releases)
All checks were successful
Update changelog / changelog (push) Successful in 26s

Docker images will now be built on every release
This commit is contained in:
2025-12-09 12:32:38 +01:00
parent 8fb05f2662
commit 58460d988d
3 changed files with 81 additions and 7 deletions

View File

@@ -2,11 +2,12 @@
# https://gitea.com/gitea/runner-images/src/branch/main/.gitea/workflows/release.yaml
name: Build and push Docker image
run-name: Building image on ${{ gitea.actor }}'s commit
run-name: Build ${{ github.ref_name }} image
on:
push:
branches: [ master ]
tags:
- "*"
jobs:
build:
@@ -34,8 +35,9 @@ jobs:
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
echo branch_name="$BRANCH_NAME" | tee -a $GITHUB_OUTPUT
echo short_hash=$(git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
#echo branch_name="$BRANCH_NAME" | tee -a $GITHUB_OUTPUT
#echo short_hash=$(git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
echo current_tag=$GITHUB_REF_NAME | tee -a $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v6
@@ -46,10 +48,11 @@ jobs:
linux/arm64
pull: true
push: true
# Change when working on a different branch!
tags: |
gitea.7o7.cx/kittyteam/kittybe:${{ steps.vars.outputs.branch_name }}-${{ steps.vars.outputs.short_hash }}
gitea.7o7.cx/kittyteam/kittybe:${{ steps.vars.outputs.branch_name }}-latest
gitea.7o7.cx/kittyteam/kittybe:master-${{ steps.vars.outputs.current_tag }}
gitea.7o7.cx/kittyteam/kittybe:latest
- name: Log out from registry
if: always()
run: docker logout gitea.7o7.cx
run: docker logout gitea.7o7.cx

View File

@@ -0,0 +1,34 @@
# Credits: # https://gitea.com/gitea/runner-images/src/branch/main/.gitea/workflows/release.yaml
name: Release new version
run-name: Release ${{ github.ref_name }}
on:
push:
tags:
- "*"
jobs:
release:
runs-on: ubuntu-latest
container: docker.io/thegeeklab/git-sv:2.0.9
steps:
- name: install tools
run: |
apk add -q --update --no-cache nodejs
- uses: actions/checkout@v6
with:
fetch-tags: true
fetch-depth: 0
- name: Create changelog
run: |
git sv current-version
git sv release-notes -t ${GITHUB_REF#refs/tags/} -o CHANGELOG.md
sed -i '1,2d' CHANGELOG.md # remove version
cat CHANGELOG.md
- name: Release
uses: https://github.com/akkuman/gitea-release-action@v1
with:
body_path: CHANGELOG.md
token: "${{ secrets.REPO_RW_TOKEN }}"

View File

@@ -0,0 +1,37 @@
# Credit: https://gitea.com/gitea/helm-gitea/src/branch/main/.gitea/workflows/changelog.yml
name: Update changelog
run-name: Update changelog on push
on:
push:
branches:
- master
tags:
- "*"
jobs:
changelog:
runs-on: ubuntu-latest
container: docker.io/thegeeklab/git-sv:2.0.9
steps:
- name: Install tools
run: |
apk add -q --update --no-cache nodejs curl jq sed
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Generate upcoming changelog
run: |
git sv rn -o changelog.md
export RELEASE_NOTES=$(cat changelog.md)
export ISSUE_NUMBER=$(curl -s -H 'Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}' "https://gitea.7o7.cx/api/v1/repos/kittyteam/kittyBE/issues?state=open&q=Changelog%20for%20upcoming%20version" | jq '.[].number')
echo $RELEASE_NOTES
JSON_DATA=$(echo "" | jq -Rs --arg title 'Changelog for upcoming version' --arg body "$(cat changelog.md)" '{title: $title, body: $body}')
if [ -z "$ISSUE_NUMBER" ]; then
curl -s -X POST "https://gitea.7o7.cx/api/v1/repos/kittyteam/kittyBE/issues" -H "Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA" > /dev/null
else
curl -s -X PATCH "https://gitea.7o7.cx/api/v1/repos/kittyteam/kittyBE/issues/$ISSUE_NUMBER" -H "Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA" > /dev/null
fi