Generate Gateway and Plugins Changelogs #8
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
| name: Generate Gateway and Plugins Changelogs | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Gateway version to generate changelog for (e.g., 3.10.0.2). Leave empty to generate for all versions.' | |
| required: true | |
| type: string | |
| kong_ee_branch: | |
| description: 'Branch to use from kong-ee repository' | |
| required: true | |
| default: 'main' | |
| type: string | |
| dev_site_base_branch: | |
| description: 'Dev site base branch, e.g. main' | |
| required: true | |
| type: string | |
| release_date: | |
| description: 'Release date for the version (YYYY/MM/DD format). Only used when version is specified.' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| generate-changelogs: | |
| name: Generate Gateway and Plugins Changelogs | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3 | |
| with: | |
| egress-policy: audit | |
| - name: Create GitHub App Token | |
| uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.GH_APP_KONG_DOCS_ID }} | |
| private-key: ${{ secrets.GH_APP_KONG_DOCS_SECRET }} | |
| owner: Kong | |
| - name: Checkout developer.konghq.com | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| cache-dependency-path: | | |
| tools/changelog-generator/package-lock.json | |
| tools/plugins-changelog-generator/package-lock.json | |
| - name: Install changelog generator dependencies | |
| run: | | |
| cd tools/changelog-generator | |
| npm ci | |
| cd ../plugins-changelog-generator | |
| npm ci | |
| - name: Checkout kong-ee repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| with: | |
| repository: 'Kong/kong-ee' | |
| token: ${{ steps.app-token.outputs.token }} | |
| path: 'kong-ee' | |
| ref: ${{ inputs.kong_ee_branch }} | |
| - name: Clear temp directory | |
| run: | | |
| cd tools/changelog-generator | |
| rm -rf tmp | |
| mkdir -p tmp | |
| - name: Generate changelog for specific version | |
| if: ${{ inputs.version != '' }} | |
| run: | | |
| cd tools/changelog-generator | |
| node run.js --path='../../kong-ee' --version='${{ inputs.version }}' | |
| - name: Update release date in gateway.yml | |
| run: | | |
| sed -i "/^release_dates:/a\\ '${{ inputs.version }}': ${{ inputs.release_date }}" app/_data/products/gateway.yml | |
| - name: Generate/update changelog file | |
| run: | | |
| cd tools/changelog-generator | |
| node changelog.js | |
| - name: Generate plugins changelogs | |
| run: | | |
| cd tools/plugins-changelog-generator | |
| node run.js --version='${{ inputs.version }}' | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if git diff --quiet; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create pull request | |
| if: steps.changes.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7 | |
| with: | |
| title: Generate Gateway and plugins changelogs for version ${{ inputs.version }} | |
| commit-message: Generate Gateway and plugins changelogs for version ${{ inputs.version }} | |
| body: | | |
| **Changes:** | |
| - Generated changelog entries for Gateway | |
| - Generated changelog entries for plugins | |
| ${{format('- Updated changelog for Gateway version {0}', inputs.version)}} | |
| ${{format('- Set release date for version {0} to {1}', inputs.version, inputs.release_date)}} | |
| labels: skip-changelog,review:general | |
| token: ${{ steps.app-token.outputs.token }} | |
| branch: auto/generate-gateway-plugins-changelogs-${{ github.run_number }} | |
| base: ${{ inputs.dev_site_base_branch }} | |
| add-paths: | | |
| app/** | |
| - name: No changes detected | |
| if: steps.changes.outputs.changed == 'false' | |
| run: | | |
| echo "No changes detected in the changelog files. No pull request will be created." |