DEV: Add release-notes GitHub workflow (#26060)

This commit is contained in:
David Taylor 2024-03-06 17:45:38 +00:00 committed by GitHub
parent 4e80ad0724
commit 99b6068ede
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

89
.github/workflows/release-notes.yml vendored Normal file
View File

@ -0,0 +1,89 @@
name: Release Notes
on:
workflow_dispatch:
from:
description: 'Starting ref (exclusive). Can be a tag, branch or commit ref'
required: true
default: 'latest-release'
type: string
to:
description: 'Ending ref (inclusive). Can be a tag, branch or commit ref'
required: true
default: 'HEAD'
type: string
permissions:
contents: read
jobs:
build:
name: run
runs-on: ubuntu-latest
container: discourse/discourse_test:slim
timeout-minutes: 10
steps:
- name: Set working directory owner
run: chown root:root .
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Bundler cache
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gem-
- name: Setup gems
run: |
bundle config --local path vendor/bundle
bundle config --local deployment true
bundle config --local without development
bundle install --jobs 4
bundle clean
- name: Create output dir
run: mkdir -p tmp/notes
- name: Core release notes
run: bin/rake "release_note:generate[${{ inputs.from || 'latest-release' }},${{ inputs.to || 'HEAD' }}]" | tee tmp/notes/core.txt
- name: Calculate from/to dates from refs
id: dates
run: |
from=$(git show -s --date=format:'%Y-%m-%d' --format=%cd "${{ inputs.from || 'latest-release' }}^{commit}")
echo "from=$from" >> $GITHUB_OUTPUT
to=$(git show -s --date=format:'%Y-%m-%d' --format=%cd "${{ inputs.to || 'HEAD' }}^{commit}")
echo "to=$to" >> $GITHUB_OUTPUT
- name: Setup all-the-plugins
run: |
git clone https://github.com/discourse/all-the-plugins tmp/all-the-plugins
cd tmp/all-the-plugins
./reset-all-repos
- name: Plugin release notes
run: |
bin/rake "release_note:plugins:generate[ ${{ steps.dates.outputs.from }} , ${{ steps.dates.outputs.to }} , ./tmp/all-the-plugins/official/* , discourse ]" | tee tmp/notes/plugins.txt
- name: Export files
uses: actions/upload-artifact@v4
with:
name: release-notes
path: ./tmp/notes/*.txt
- name: Write summary
run: |
echo "Core:" >> $GITHUB_STEP_SUMMARY
echo '~~~' >> $GITHUB_STEP_SUMMARY
cat tmp/notes/core.txt >> $GITHUB_STEP_SUMMARY
echo '~~~' >> $GITHUB_STEP_SUMMARY
echo ""
echo "Plugins:" >> $GITHUB_STEP_SUMMARY
echo '~~~' >> $GITHUB_STEP_SUMMARY
cat tmp/notes/plugins.txt >> $GITHUB_STEP_SUMMARY
echo '~~~' >> $GITHUB_STEP_SUMMARY