chore: changelog generation

This commit is contained in:
zhom
2026-03-24 01:48:59 +04:00
parent c2d59e7faf
commit 084e63eb1e
2 changed files with 159 additions and 96 deletions
+108 -95
View File
@@ -231,102 +231,115 @@ jobs:
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true
rm -f $RUNNER_TEMP/build_certificate.p12 || true rm -f $RUNNER_TEMP/build_certificate.p12 || true
# - name: Commit CHANGELOG.md changelog:
# uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 #v6.0.1 if: github.repository == 'zhom/donutbrowser'
# with: needs: [release]
# branch: main runs-on: ubuntu-latest
# commit_message: "docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]" permissions:
contents: write
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
with:
ref: main
fetch-depth: 0
# publish-repos: - name: Generate changelog
# if: github.repository == 'zhom/donutbrowser' env:
# needs: [release] TAG: ${{ github.ref_name }}
# runs-on: ubuntu-latest run: |
# permissions: PREV_TAG=$(git tag --sort=-version:refname \
# contents: read | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \
# steps: | grep -v "^${TAG}$" \
# - name: Download Linux packages from release | head -n 1)
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} if [ -z "$PREV_TAG" ]; then
# run: | PREV_TAG=$(git rev-list --max-parents=0 HEAD)
# mkdir -p /tmp/packages fi
# gh release download "$GITHUB_REF_NAME" \
# --repo "$GITHUB_REPOSITORY" \ echo "Generating changelog: ${PREV_TAG}..${TAG}"
# --pattern "*.deb" \
# --dir /tmp/packages features=""
# gh release download "$GITHUB_REF_NAME" \ fixes=""
# --repo "$GITHUB_REPOSITORY" \ refactors=""
# --pattern "*.rpm" \ perf=""
# --dir /tmp/packages docs=""
# echo "Downloaded packages:" maintenance=""
# ls -la /tmp/packages/ other=""
#
# - name: Setup Go strip_prefix() { echo "$1" | sed -E 's/^[a-z]+(\([^)]*\))?: //'; }
# uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0
# with: while IFS= read -r msg; do
# go-version: "1.23" [ -z "$msg" ] && continue
# cache: false case "$msg" in
# feat\(*\):*|feat:*)
# - name: Install repogen features="${features}- $(strip_prefix "$msg")"$'\n' ;;
# run: | fix\(*\):*|fix:*)
# go install github.com/ralt/repogen/cmd/repogen@latest fixes="${fixes}- $(strip_prefix "$msg")"$'\n' ;;
# echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" refactor\(*\):*|refactor:*)
# refactors="${refactors}- $(strip_prefix "$msg")"$'\n' ;;
# - name: Sync existing repo metadata from R2 perf\(*\):*|perf:*)
# env: perf="${perf}- $(strip_prefix "$msg")"$'\n' ;;
# AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} docs\(*\):*|docs:*)
# AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} docs="${docs}- $(strip_prefix "$msg")"$'\n' ;;
# AWS_DEFAULT_REGION: auto build*|ci*|chore*|test*)
# R2_ENDPOINT: "https://${{ secrets.R2_ENDPOINT_URL }}" maintenance="${maintenance}- ${msg}"$'\n' ;;
# R2_BUCKET: ${{ secrets.R2_BUCKET_NAME }} *)
# run: | other="${other}- ${msg}"$'\n' ;;
# mkdir -p /tmp/repo esac
# aws s3 cp "s3://${R2_BUCKET}/dists" /tmp/repo/dists \ done < <(git log --pretty=format:"%s" "${PREV_TAG}..${TAG}" --no-merges)
# --endpoint-url "${R2_ENDPOINT}" --recursive 2>/dev/null || true
# aws s3 cp "s3://${R2_BUCKET}/repodata" /tmp/repo/repodata \ {
# --endpoint-url "${R2_ENDPOINT}" --recursive 2>/dev/null || true echo "## ${TAG} ($(date -u +%Y-%m-%d))"
# echo ""
# - name: Generate repository with repogen [ -n "$features" ] && printf "### Features\n\n%s\n" "$features"
# run: | [ -n "$fixes" ] && printf "### Bug Fixes\n\n%s\n" "$fixes"
# repogen generate \ [ -n "$refactors" ] && printf "### Refactoring\n\n%s\n" "$refactors"
# --input-dir /tmp/packages \ [ -n "$perf" ] && printf "### Performance\n\n%s\n" "$perf"
# --output-dir /tmp/repo \ [ -n "$docs" ] && printf "### Documentation\n\n%s\n" "$docs"
# --incremental \ [ -n "$maintenance" ] && printf "### Maintenance\n\n%s\n" "$maintenance"
# --arch amd64,arm64 \ [ -n "$other" ] && printf "### Other\n\n%s\n" "$other"
# --origin "Donut Browser" \ } > /tmp/release-changelog.md
# --label "Donut Browser" \
# --codename stable \ echo "Generated changelog:"
# --components main \ cat /tmp/release-changelog.md
# --verbose
# - name: Update CHANGELOG.md
# - name: Upload repository to R2 run: |
# env: if [ -f CHANGELOG.md ]; then
# AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} # Insert new entry after the "# Changelog" header (first 2 lines)
# AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} {
# AWS_DEFAULT_REGION: auto head -n 2 CHANGELOG.md
# R2_ENDPOINT: "https://${{ secrets.R2_ENDPOINT_URL }}" echo ""
# R2_BUCKET: ${{ secrets.R2_BUCKET_NAME }} cat /tmp/release-changelog.md
# run: | tail -n +3 CHANGELOG.md
# aws s3 cp /tmp/repo/dists "s3://${R2_BUCKET}/dists" \ } > CHANGELOG.tmp
# --endpoint-url "${R2_ENDPOINT}" --recursive mv CHANGELOG.tmp CHANGELOG.md
# aws s3 cp /tmp/repo/pool "s3://${R2_BUCKET}/pool" \ else
# --endpoint-url "${R2_ENDPOINT}" --recursive {
# aws s3 cp /tmp/repo/repodata "s3://${R2_BUCKET}/repodata" \ echo "# Changelog"
# --endpoint-url "${R2_ENDPOINT}" --recursive echo ""
# aws s3 cp /tmp/repo/Packages "s3://${R2_BUCKET}/Packages" \ cat /tmp/release-changelog.md
# --endpoint-url "${R2_ENDPOINT}" --recursive } > CHANGELOG.md
# fi
# - name: Verify upload
# env: - name: Commit CHANGELOG.md
# AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} run: |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} git config user.name "github-actions[bot]"
# AWS_DEFAULT_REGION: auto git config user.email "github-actions[bot]@users.noreply.github.com"
# R2_ENDPOINT: "https://${{ secrets.R2_ENDPOINT_URL }}" git add CHANGELOG.md
# R2_BUCKET: ${{ secrets.R2_BUCKET_NAME }} if git diff --cached --quiet; then
# run: | echo "No changelog changes to commit"
# echo "DEB repo:" else
# aws s3 ls "s3://${R2_BUCKET}/dists/stable/" --endpoint-url "${R2_ENDPOINT}" || echo " (listing not available)" git commit -m "docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]"
# echo "RPM repo:" git push origin main
# aws s3 ls "s3://${R2_BUCKET}/repodata/" --endpoint-url "${R2_ENDPOINT}" || echo " (listing not available)" fi
- name: Update release notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
gh release edit "$TAG" --notes-file /tmp/release-changelog.md
notify-discord: notify-discord:
if: github.repository == 'zhom/donutbrowser' if: github.repository == 'zhom/donutbrowser'
+51 -1
View File
@@ -257,6 +257,56 @@ jobs:
COMMIT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-7) COMMIT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-7)
echo "nightly_tag=nightly-${TIMESTAMP}-${COMMIT_HASH}" >> $GITHUB_OUTPUT echo "nightly_tag=nightly-${TIMESTAMP}-${COMMIT_HASH}" >> $GITHUB_OUTPUT
- name: Generate nightly changelog
id: nightly-changelog
run: |
LAST_STABLE=$(git tag --sort=-version:refname \
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \
| head -n 1)
if [ -z "$LAST_STABLE" ]; then
LAST_STABLE=$(git rev-list --max-parents=0 HEAD)
fi
COMMIT_SHORT=$(echo "${GITHUB_SHA}" | cut -c1-7)
{
echo "**Nightly build from main branch**"
echo ""
echo "Commit: ${GITHUB_SHA}"
echo "Changes since ${LAST_STABLE}:"
echo ""
} > /tmp/nightly-notes.md
strip_prefix() { echo "$1" | sed -E 's/^[a-z]+(\([^)]*\))?: //'; }
features=""
fixes=""
refactors=""
other=""
while IFS= read -r msg; do
[ -z "$msg" ] && continue
case "$msg" in
feat\(*\):*|feat:*)
features="${features}- $(strip_prefix "$msg")"$'\n' ;;
fix\(*\):*|fix:*)
fixes="${fixes}- $(strip_prefix "$msg")"$'\n' ;;
refactor\(*\):*|refactor:*)
refactors="${refactors}- $(strip_prefix "$msg")"$'\n' ;;
build*|ci*|chore*|test*|docs*|perf*)
;; # skip maintenance commits from nightly notes
*)
other="${other}- ${msg}"$'\n' ;;
esac
done < <(git log --pretty=format:"%s" "${LAST_STABLE}..HEAD" --no-merges)
{
[ -n "$features" ] && printf "### Features\n\n%s\n" "$features"
[ -n "$fixes" ] && printf "### Bug Fixes\n\n%s\n" "$fixes"
[ -n "$refactors" ] && printf "### Refactoring\n\n%s\n" "$refactors"
[ -n "$other" ] && printf "### Other\n\n%s\n" "$other"
} >> /tmp/nightly-notes.md
- name: Update rolling nightly release - name: Update rolling nightly release
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -291,7 +341,7 @@ jobs:
"$ASSETS_DIR"/Donut_aarch64.app.tar.gz \ "$ASSETS_DIR"/Donut_aarch64.app.tar.gz \
"$ASSETS_DIR"/Donut_x64.app.tar.gz \ "$ASSETS_DIR"/Donut_x64.app.tar.gz \
--title "Donut Browser Nightly" \ --title "Donut Browser Nightly" \
--notes "Automatically updated nightly build from the latest main branch.\n\nCommit: ${GITHUB_SHA}" \ --notes-file /tmp/nightly-notes.md \
--prerelease --prerelease
notify-discord: notify-discord: