Skip to content

Commit 82214f0

Browse files
authored
Merge pull request #53079 from nextcloud/backport/53054/stable30
2 parents 3a1a886 + 9f0c7eb commit 82214f0

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: MIT
3+
4+
name: Generate changelog on release
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
changelog_generate:
15+
runs-on: ubuntu-latest
16+
17+
# Only allowed to be run on nextcloud-releases repositories
18+
if: ${{ github.repository_owner == 'nextcloud-releases' }}
19+
20+
steps:
21+
- name: Check actor permission
22+
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
23+
with:
24+
require: write
25+
26+
- name: Checkout github_helper
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
persist-credentials: false
30+
repository: nextcloud/github_helper
31+
path: github_helper
32+
33+
- name: Checkout server
34+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
with:
36+
persist-credentials: false
37+
path: server
38+
fetch-depth: 0
39+
40+
- name: Get previous tag
41+
shell: bash
42+
run: |
43+
cd server
44+
# Print all tags
45+
git log --decorate --oneline | egrep '^[0-9a-f]+ \((HEAD, )?tag: ' | sed -r 's/^.+tag: ([^ ]+)[,\)].+$/\1/g'
46+
# Get the current tag
47+
TAGS=$(git log --decorate --oneline | egrep '^[0-9a-f]+ \((HEAD, )?tag: ' | sed -r 's/^.+tag: ([^ ]+)[,\)].+$/\1/g')
48+
CURRENT_TAG=$(echo "$TAGS" | head -n 1)
49+
# Get the previous tag that is not an rc, beta or alpha
50+
PREVIOUS_TAG=$(echo "$TAGS" | grep -v 'rc\|beta\|alpha' | sed -n '2p')
51+
echo "CURRENT_TAG=$CURRENT_TAG" >> $GITHUB_ENV
52+
echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_ENV
53+
54+
- name: Verify current tag
55+
run: |
56+
if [ "${{ github.ref_name }}" != "${{ env.CURRENT_TAG }}" ]; then
57+
echo "Current tag does not match the release tag. Exiting."
58+
exit 1
59+
fi
60+
61+
- name: Set up php 8.2
62+
uses: shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
63+
with:
64+
php-version: 8.2
65+
coverage: none
66+
ini-file: development
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: Set credentials
71+
run: |
72+
echo '{"username": "github-actions"}' > github_helper/credentials.json
73+
74+
- name: Generate changelog between ${{ env.PREVIOUS_TAG }} and ${{ github.ref_name }}
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
run: |
78+
cd github_helper/changelog
79+
composer install
80+
php index.php generate:changelog --no-bots --format=forum server ${{ env.PREVIOUS_TAG }} ${{ github.ref_name }} > changelog.md
81+
82+
- name: Set changelog to release
83+
env:
84+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
run: |
86+
cd server
87+
gh release edit ${{ github.ref_name }} --notes-file "../github_helper/changelog/changelog.md" --title "${{ github.ref_name }}"

0 commit comments

Comments
 (0)