chore(workflows): add CI workflows and configuration files
- Add default merge message template for PRs - Introduce workflow for major version tag creation on release - Add workflow for auto changelog and release generation - Add git-cliff configuration for changelog formatting - Configure `.vscode` workspace settings and `.gitignore` updates
This commit is contained in:
5
.gitea/default_merge_message/MERGE_TEMPLATE.md
Normal file
5
.gitea/default_merge_message/MERGE_TEMPLATE.md
Normal file
@@ -0,0 +1,5 @@
|
||||
chore(pr): ${PullRequestTitle} ${PullRequestReference}
|
||||
|
||||
${PullRequestDescription}
|
||||
|
||||
Merged from ${HeadBranch} into ${BaseBranch}
|
61
.gitea/workflows/create-major-tag.yml
Normal file
61
.gitea/workflows/create-major-tag.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
name: Create Major Version Tag
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
update-major-tag:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # required to delete/create tags
|
||||
|
||||
steps:
|
||||
# ▸ 1. Check out the repository at the release tag
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # fetch all tags
|
||||
ref: ${{ github.event.release.tag_name }}
|
||||
|
||||
# ▸ 2. Extract the major version from the release tag
|
||||
- name: Derive major version
|
||||
id: derive
|
||||
shell: bash
|
||||
run: |
|
||||
TAG="${{ github.event.release.tag_name }}" # e.g., v2.3.4
|
||||
echo "Release tag: $TAG"
|
||||
|
||||
TAG_NOPREFIX="${TAG#v}" # remove leading v/V
|
||||
MAJOR="${TAG_NOPREFIX%%.*}" # take part before the first dot
|
||||
MAJOR_TAG="v${MAJOR}" # e.g., v2
|
||||
|
||||
echo "Major tag: $MAJOR_TAG"
|
||||
echo "major_tag=$MAJOR_TAG" >>"$GITHUB_OUTPUT"
|
||||
|
||||
# ▸ 3. Delete the old major tag (if it exists) and create a new one
|
||||
- name: Re-create major tag
|
||||
env:
|
||||
MAJOR_TAG: ${{ steps.derive.outputs.major_tag }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
git config user.name "$CI_COMMIT_AUTHOR_NAME"
|
||||
git config user.email "$CI_COMMIT_AUTHOR_EMAIL"
|
||||
|
||||
# Determine the specific commit of the release tag
|
||||
COMMIT_SHA="$(git rev-list -n 1 "$RELEASE_TAG")"
|
||||
|
||||
echo "Commit of the release tag: $COMMIT_SHA"
|
||||
|
||||
# (a) Locally and remotely remove the old major tag (if it exists)
|
||||
git tag -d "$MAJOR_TAG" 2>/dev/null || true
|
||||
git push --delete origin "$MAJOR_TAG" 2>/dev/null || true
|
||||
|
||||
# (b) Create and push a new annotated tag
|
||||
git tag -a "$MAJOR_TAG" "$COMMIT_SHA" \
|
||||
-m "Update $MAJOR_TAG → $RELEASE_TAG"
|
||||
git push origin "$MAJOR_TAG"
|
||||
|
||||
echo "✅ $MAJOR_TAG now points to $RELEASE_TAG ($COMMIT_SHA)"
|
19
.gitea/workflows/release.yml
Normal file
19
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Auto Changelog & Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Release
|
||||
uses: https://git.0xmax42.io/actions/auto-changelog-release-action@v0
|
||||
with:
|
||||
token: ${{ secrets.RELEASE_PUBLISH_TOKEN }}
|
Reference in New Issue
Block a user