Compare commits
5 Commits
9fba7f7d10
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| aaf165811f | |||
|
410b17e494
|
|||
| cdeeebea90 | |||
|
bf4aa3f393
|
|||
|
8850e5e478
|
126
.gitea/workflows/release-on-pages.yml
Normal file
126
.gitea/workflows/release-on-pages.yml
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
name: Build Tags Export
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-tags:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Fetch tags list
|
||||||
|
run: |
|
||||||
|
git tag > tags.txt
|
||||||
|
|
||||||
|
- name: Prepare target directory
|
||||||
|
run: mkdir -p TARGET
|
||||||
|
|
||||||
|
- name: Checkout all tags and export
|
||||||
|
run: |
|
||||||
|
while read TAG; do
|
||||||
|
echo "Processing tag: $TAG"
|
||||||
|
mkdir -p "TARGET/$TAG"
|
||||||
|
|
||||||
|
# Sauber: Clonen aus dem lokalen Checkout
|
||||||
|
git clone . "workdir" --branch "$TAG" --depth 1
|
||||||
|
|
||||||
|
cp -a workdir/* "TARGET/$TAG/"
|
||||||
|
rm -rf workdir
|
||||||
|
done < tags.txt
|
||||||
|
|
||||||
|
- name: Upload as artifact (optional)
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: all-tags
|
||||||
|
path: TARGET/
|
||||||
|
|
||||||
|
publish-pages:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build-tags
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository (for push setup)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Download Artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: all-tags
|
||||||
|
path: TAGS_EXPORT
|
||||||
|
|
||||||
|
- name: Git Configure
|
||||||
|
run: |
|
||||||
|
git config --global user.name "$CI_COMMIT_AUTHOR_NAME"
|
||||||
|
git config --global user.email "$CI_COMMIT_AUTHOR_EMAIL"
|
||||||
|
|
||||||
|
- name: Check pages branch
|
||||||
|
id: check
|
||||||
|
run: |
|
||||||
|
if git ls-remote --exit-code origin pages > /dev/null; then
|
||||||
|
echo "exists=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "exists=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Clone pages branch into repo/
|
||||||
|
run: |
|
||||||
|
REPO_URL_BASE="$(echo $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git | sed 's/^https\?:\/\///')"
|
||||||
|
AUTH_URL="https://${{ secrets.PACKAGE_USER }}:${{ secrets.PACKAGE_TOKEN }}@$REPO_URL_BASE"
|
||||||
|
|
||||||
|
echo "::add-mask::$AUTH_URL"
|
||||||
|
echo "📡 Klone Repository von: $AUTH_URL"
|
||||||
|
|
||||||
|
if [ "${{ steps.check.outputs.exists }}" = "true" ]; then
|
||||||
|
git clone --depth 1 --branch pages "$AUTH_URL" repo
|
||||||
|
else
|
||||||
|
# Branch existiert nicht → ohne Branch klonen, später orphan erzeugen
|
||||||
|
git clone --depth 1 "$AUTH_URL" repo
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Prepare pages branch
|
||||||
|
working-directory: repo
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.check.outputs.exists }}" = "true" ]; then
|
||||||
|
echo "📥 Checkout existing pages"
|
||||||
|
git checkout pages
|
||||||
|
else
|
||||||
|
echo "🌱 Create orphan"
|
||||||
|
git checkout --orphan pages
|
||||||
|
git reset --hard
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Alles löschen für frischen Inhalt
|
||||||
|
rm -rf *
|
||||||
|
|
||||||
|
- name: Copy tag export
|
||||||
|
run: cp -a TAGS_EXPORT/* repo/
|
||||||
|
|
||||||
|
- name: Commit
|
||||||
|
working-directory: repo
|
||||||
|
run: |
|
||||||
|
git add -A
|
||||||
|
git commit --allow-empty -m "CI: Update Pages ($(date -u +"%Y-%m-%d %H:%M:%S"))" || echo "⚠️ Nothing to commit"
|
||||||
|
|
||||||
|
- name: Set new remote (auth)
|
||||||
|
working-directory: repo
|
||||||
|
run: |
|
||||||
|
REPO_URL_BASE="$(echo $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git | sed 's/^https\?:\/\///')"
|
||||||
|
AUTH_URL="https://${{ secrets.PACKAGE_USER }}:${{ secrets.PACKAGE_TOKEN }}@$REPO_URL_BASE"
|
||||||
|
git remote set-url origin "$AUTH_URL"
|
||||||
|
|
||||||
|
- name: Push pages branch
|
||||||
|
working-directory: repo
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.check.outputs.exists }}" = "true" ]; then
|
||||||
|
echo "🚀 Normal push"
|
||||||
|
git push origin pages
|
||||||
|
else
|
||||||
|
echo "⛔ Force push orphan"
|
||||||
|
git push origin pages --force
|
||||||
|
fi
|
||||||
@@ -1,223 +1,18 @@
|
|||||||
name: Auto Changelog & Release
|
name: Auto Changelog & (Release)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- "**"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
detect-version-change:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
version_changed: ${{ steps.set.outputs.version_changed }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Check if VERSION file changed
|
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
run: |
|
|
||||||
echo "🔍 Vergleich mit github.event.before:"
|
|
||||||
echo "Before: ${{ github.event.before }}"
|
|
||||||
echo "After: ${{ github.sha }}"
|
|
||||||
|
|
||||||
echo "📄 Changed files between before and after:"
|
|
||||||
git diff --name-only ${{ github.event.before }} ${{ github.sha }} || echo "(diff failed)"
|
|
||||||
|
|
||||||
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^VERSION$'; then
|
|
||||||
echo "✅ VERSION file was changed"
|
|
||||||
echo "VERSION_CHANGED=true" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "ℹ️ VERSION file not changed"
|
|
||||||
echo "VERSION_CHANGED=false" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Set output (always)
|
|
||||||
id: set
|
|
||||||
run: |
|
|
||||||
echo "version_changed=${VERSION_CHANGED:-false}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
changelog-only:
|
|
||||||
needs: detect-version-change
|
|
||||||
if: github.ref != 'refs/heads/main' || needs.detect-version-change.outputs.version_changed == 'false'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set Git Author
|
|
||||||
run: |
|
|
||||||
git config user.name "$CI_COMMIT_AUTHOR_NAME"
|
|
||||||
git config user.email "$CI_COMMIT_AUTHOR_EMAIL"
|
|
||||||
|
|
||||||
- name: Read CLIFF_VERSION from cliff.toml
|
|
||||||
id: cliff_version
|
|
||||||
run: |
|
|
||||||
echo "version=$(awk -F '=' '/^# CLIFF_VERSION=/ { gsub(/[" ]/, "", $2); print $2 }' cliff.toml)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Restore git-cliff cache
|
|
||||||
id: restore-cliff
|
|
||||||
uses: https://git.0xmax42.io/actions/cache@v1
|
|
||||||
with:
|
|
||||||
key: cargo-cliff-${{ steps.cliff_version.outputs.version }}
|
|
||||||
paths: |
|
|
||||||
/root/.cargo/bin
|
|
||||||
|
|
||||||
- name: Install git-cliff
|
|
||||||
if: steps.restore-cliff.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
cargo install git-cliff --locked --version "${{ steps.cliff_version.outputs.version }}" --features gitea
|
|
||||||
|
|
||||||
- name: Generate unreleased changelog (if file exists or on main)
|
|
||||||
run: |
|
|
||||||
if [[ -f CHANGELOG.md || "${GITHUB_REF##refs/heads/}" == "main" ]]; then
|
|
||||||
echo "Generating CHANGELOG.md..."
|
|
||||||
git-cliff -c cliff.toml -o CHANGELOG.md
|
|
||||||
else
|
|
||||||
echo "CHANGELOG.md does not exist and this is not 'main'. Skipping generation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Commit updated CHANGELOG
|
|
||||||
run: |
|
|
||||||
git add CHANGELOG.md
|
|
||||||
if git diff --cached --quiet; then
|
|
||||||
echo "No changes to commit"
|
|
||||||
else
|
|
||||||
git commit -m "chore(changelog): update unreleased changelog"
|
|
||||||
git push origin "${GITHUB_REF##refs/heads/}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: detect-version-change
|
|
||||||
if: needs.detect-version-change.outputs.version_changed == 'true' && github.ref == 'refs/heads/main'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- name: Release
|
||||||
- name: Set Git Author
|
uses: https://git.0xmax42.io/actions/auto-changelog-release-action@v1
|
||||||
run: |
|
|
||||||
git config user.name "$CI_COMMIT_AUTHOR_NAME"
|
|
||||||
git config user.email "$CI_COMMIT_AUTHOR_EMAIL"
|
|
||||||
|
|
||||||
- name: Read VERSION
|
|
||||||
id: version
|
|
||||||
run: echo "value=$(cat VERSION)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Read CLIFF_VERSION from cliff.toml
|
|
||||||
id: cliff_version
|
|
||||||
run: |
|
|
||||||
echo "version=$(awk -F '=' '/^# CLIFF_VERSION=/ { gsub(/[" ]/, "", $2); print $2 }' cliff.toml)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Restore git-cliff cache
|
|
||||||
id: restore-cliff
|
|
||||||
uses: https://git.0xmax42.io/actions/cache@v1
|
|
||||||
with:
|
with:
|
||||||
key: cargo-cliff-${{ steps.cliff_version.outputs.version }}
|
token: ${{ secrets.RELEASE_PUBLISH_TOKEN }}
|
||||||
paths: |
|
|
||||||
/root/.cargo/bin
|
|
||||||
|
|
||||||
- name: Install git-cliff
|
|
||||||
if: steps.restore-cliff.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
cargo install git-cliff --locked --version "${{ steps.cliff_version.outputs.version }}" --features gitea
|
|
||||||
|
|
||||||
- name: Generate changelog for release and tag
|
|
||||||
id: generate-changelog
|
|
||||||
run: |
|
|
||||||
VERSION=${{ steps.version.outputs.value }}
|
|
||||||
git-cliff -c cliff.toml -t "v$VERSION" -o CHANGELOG.md
|
|
||||||
|
|
||||||
BODY=$(mktemp)
|
|
||||||
ESCAPED_VERSION=$(echo "$VERSION" | sed 's/\./\\./g')
|
|
||||||
|
|
||||||
awk -v ver="$ESCAPED_VERSION" '
|
|
||||||
$0 ~ "^## \\[" ver "\\]" {
|
|
||||||
print_flag=1
|
|
||||||
line = $0
|
|
||||||
sub(/^## /, "", line)
|
|
||||||
sub(/\\s*\\(.*\\)/, "", line) # entfernt z. B. "(...)" oder "(*)"
|
|
||||||
print line
|
|
||||||
next
|
|
||||||
}
|
|
||||||
$0 ~ "^## \\[" && $0 !~ "^## \\[" ver "\\]" {
|
|
||||||
print_flag=0
|
|
||||||
}
|
|
||||||
print_flag
|
|
||||||
' CHANGELOG.md > "$BODY"
|
|
||||||
|
|
||||||
echo "changelog_body_path=$BODY" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Commit updated CHANGELOG
|
|
||||||
run: |
|
|
||||||
git add CHANGELOG.md
|
|
||||||
if git diff --cached --quiet; then
|
|
||||||
echo "No changes to commit"
|
|
||||||
else
|
|
||||||
git commit -m "chore(changelog): update changelog for v${{ steps.version.outputs.value }}"
|
|
||||||
git push origin main
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create Git tag (if not exists)
|
|
||||||
run: |
|
|
||||||
VERSION=${{ steps.version.outputs.value }}
|
|
||||||
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
|
||||||
echo "Tag v$VERSION already exists, skipping tag creation."
|
|
||||||
else
|
|
||||||
export GIT_AUTHOR_DATE="$(date --iso-8601=seconds)"
|
|
||||||
export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
|
|
||||||
git tag -a "v$VERSION" -F "${{ steps.generate-changelog.outputs.changelog_body_path }}" --cleanup=verbatim
|
|
||||||
git push origin "v$VERSION"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create Gitea release
|
|
||||||
env:
|
|
||||||
RELEASE_PUBLISH_TOKEN: ${{ secrets.RELEASE_PUBLISH_TOKEN }}
|
|
||||||
run: |
|
|
||||||
VERSION=${{ steps.version.outputs.value }}
|
|
||||||
BODY_FILE="${{ steps.generate-changelog.outputs.changelog_body_path }}"
|
|
||||||
|
|
||||||
OWNER=$(echo "$GITHUB_REPOSITORY" | cut -d/ -f1)
|
|
||||||
REPO=$(echo "$GITHUB_REPOSITORY" | cut -d/ -f2)
|
|
||||||
|
|
||||||
# Token-Auswahl
|
|
||||||
TOKEN="${RELEASE_PUBLISH_TOKEN:-$ACTIONS_RUNTIME_TOKEN}"
|
|
||||||
|
|
||||||
if [[ -z "${RELEASE_PUBLISH_TOKEN:-}" ]]; then
|
|
||||||
echo "::warning title=Limited Release Propagation::"
|
|
||||||
echo "RELEASE_PUBLISH_TOKEN is not set. Using ACTIONS_RUNTIME_TOKEN instead."
|
|
||||||
echo "⚠️ Release events may not trigger other workflows if created with the runtime token."
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Prüfe, ob der Release schon existiert
|
|
||||||
if curl -sf "$GITHUB_API_URL/repos/$OWNER/$REPO/releases/tags/v$VERSION" \
|
|
||||||
-H "Authorization: token $TOKEN" > /dev/null; then
|
|
||||||
echo "🔁 Release for tag v$VERSION already exists, skipping."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "🚀 Creating Gitea release for v$VERSION"
|
|
||||||
|
|
||||||
# Release-Beschreibung vorbereiten
|
|
||||||
RELEASE_BODY=$(tail -n +2 "$BODY_FILE" | jq -Rs .)
|
|
||||||
|
|
||||||
curl -X POST "$GITHUB_API_URL/repos/$OWNER/$REPO/releases" \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d @- <<EOF
|
|
||||||
{
|
|
||||||
"tag_name": "v$VERSION",
|
|
||||||
"target_commitish": "main",
|
|
||||||
"name": "Release v$VERSION",
|
|
||||||
"body": $RELEASE_BODY,
|
|
||||||
"draft": false,
|
|
||||||
"prerelease": false
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "✅ Release for tag $VERSION created successfully."
|
|
||||||
|
|||||||
10
CHANGELOG.md
10
CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
## [unreleased]
|
## [unreleased]
|
||||||
|
|
||||||
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
|
- *(ci)* Add workflow to export and publish tags to pages branch - ([410b17e](https://git.0xmax42.io/maxp/http-kernel/commit/410b17e494e84354478abd505c2d5e24328f3cde))
|
||||||
|
|
||||||
|
## [0.2.1](https://git.0xmax42.io/maxp/http-kernel/compare/v0.2.0..v0.2.1) - 2025-11-12
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- Export errors, interfaces, types, and utils from main module - ([6d7127a](https://git.0xmax42.io/maxp/http-kernel/commit/6d7127a52f4aecfd178523c8a873ab0b558550f1))
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- *(workflows)* Remove redundant tag fallback in sync job - ([5686940](https://git.0xmax42.io/maxp/http-kernel/commit/5686940fe26b699bffa62af7fb0efc42cc85a6b3))
|
- *(workflows)* Remove redundant tag fallback in sync job - ([5686940](https://git.0xmax42.io/maxp/http-kernel/commit/5686940fe26b699bffa62af7fb0efc42cc85a6b3))
|
||||||
|
|||||||
Reference in New Issue
Block a user