Changelog v34.0.2 #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors | |
| # SPDX-License-Identifier: MIT | |
| name: Generate release changelog | |
| run-name: "Changelog ${{ inputs.tag }}" | |
| on: | |
| workflow_call: | |
| inputs: | |
| tag: | |
| required: true | |
| type: string | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Existing release tag to (re)generate changelog for (e.g., v33.0.4)' | |
| required: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| changelog_generate: | |
| runs-on: ubuntu-latest | |
| env: | |
| RELEASE_TAG: ${{ inputs.tag || github.ref_name }} | |
| steps: | |
| - name: Check actor permission | |
| uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0 | |
| with: | |
| require: write | |
| - name: Checkout github_helper | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| repository: nextcloud/github_helper | |
| path: github_helper | |
| - name: Get previous tag | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| CURRENT_TAG="${{ env.RELEASE_TAG }}" | |
| echo "Current tag: $CURRENT_TAG" | |
| # Fetch all version tags via API instead of cloning the full repo | |
| ALL_TAGS=$(gh api "repos/${{ github.repository }}/git/refs/tags" \ | |
| --paginate --jq '.[].ref | sub("refs/tags/"; "")' | \ | |
| grep -E '^v[0-9]' | sort -V) | |
| # Verify the tag exists | |
| if ! echo "$ALL_TAGS" | grep -qx "$CURRENT_TAG"; then | |
| echo "::error::Tag $CURRENT_TAG not found in repository" | |
| exit 1 | |
| fi | |
| # If current tag is the first beta, we use the previous major RC1 | |
| if echo "$CURRENT_TAG" | grep -q 'beta1'; then | |
| MAJOR=$(echo "$CURRENT_TAG" | sed -E 's/^v([0-9]+).*/\1/') | |
| PREV=$((MAJOR - 1)) | |
| PREVIOUS_TAG="v${PREV}.0.0rc1" | |
| # Pre-release: previous tag is the one right before in version order | |
| elif echo "$CURRENT_TAG" | grep -q 'rc\|beta\|alpha'; then | |
| PREVIOUS_TAG=$(echo "$ALL_TAGS" | grep -B1 "^${CURRENT_TAG}$" | head -1) | |
| # Stable: previous stable tag (skip pre-releases) | |
| else | |
| PREVIOUS_TAG=$(echo "$ALL_TAGS" | grep -v 'rc\|beta\|alpha' | grep -B1 "^${CURRENT_TAG}$" | head -1) | |
| fi | |
| if [ -z "$PREVIOUS_TAG" ] || [ "$PREVIOUS_TAG" = "$CURRENT_TAG" ]; then | |
| echo "::error::Could not determine previous tag for $CURRENT_TAG" | |
| exit 1 | |
| fi | |
| echo "Previous tag: $PREVIOUS_TAG" | |
| echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_ENV | |
| - name: Set up php 8.4 | |
| uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2 | |
| timeout-minutes: 5 | |
| with: | |
| php-version: 8.4 | |
| coverage: none | |
| ini-file: development | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set credentials | |
| run: | | |
| echo '{"username": "github-actions"}' > github_helper/credentials.json | |
| - name: Install github_helper dependencies | |
| run: | | |
| cd github_helper/changelog | |
| composer install | |
| # Since this action only runs on nextcloud-releases, ignoring is okay | |
| - name: Generate forum changelog between ${{ env.PREVIOUS_TAG }} and ${{ env.RELEASE_TAG }} # zizmor: ignore[template-injection] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| cd github_helper/changelog | |
| php index.php generate:changelog --no-bots --format=forum server ${{ env.PREVIOUS_TAG }} ${{ env.RELEASE_TAG }} > "changelog-${{ env.RELEASE_TAG }}.md" | |
| # Since this action only runs on nextcloud-releases, ignoring is okay | |
| - name: Generate HTML changelog between ${{ env.PREVIOUS_TAG }} and ${{ env.RELEASE_TAG }} # zizmor: ignore[template-injection] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| cd github_helper/changelog | |
| php index.php generate:changelog --no-bots --format=html server ${{ env.PREVIOUS_TAG }} ${{ env.RELEASE_TAG }} > "changelog-${{ env.RELEASE_TAG }}.html" | |
| # Since this action only runs on nextcloud-releases, ignoring is okay | |
| - name: Set changelog to release # zizmor: ignore[template-injection] | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release edit ${{ env.RELEASE_TAG }} \ | |
| --repo "${{ github.repository }}" \ | |
| --notes-file "github_helper/changelog/changelog-${{ env.RELEASE_TAG }}.md" \ | |
| --title "${{ env.RELEASE_TAG }}" | |
| # Since this action only runs on nextcloud-releases, ignoring is okay | |
| - name: Attach changelog files to release # zizmor: ignore[template-injection] | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload ${{ env.RELEASE_TAG }} \ | |
| "github_helper/changelog/changelog-${{ env.RELEASE_TAG }}.md" \ | |
| "github_helper/changelog/changelog-${{ env.RELEASE_TAG }}.html" \ | |
| --repo "${{ github.repository }}" \ | |
| --clobber |