diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index c7b9a4b5..f1587efe 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -114,8 +114,11 @@ jobs: - example-mods name: Release runs-on: ubuntu-latest - container: node:lts-bullseye steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + submodules: false # Dependencies - name: Install Go uses: actions/setup-go@v5 @@ -126,11 +129,15 @@ jobs: uses: actions/download-artifact@v3 with: path: out + # Get Changelog + - name: Get Changelog + id: release-info + run: ./scripts/get-changelog.mjs >> "${GITHUB_OUTPUT}" # Create Release - name: Create Release uses: https://gitea.com/actions/release-action@main with: files: ./out/*/*.AppImage* api_key: ${{ secrets.RELEASE_TOKEN }} - title: v${{ github.ref_name }} - body: '[View Changelog](https://gitea.thebrokenrail.com/minecraft-pi-reborn/minecraft-pi-reborn/src/branch/master/docs/CHANGELOG.md)' + title: v${{ steps.release-info.outputs.version }} + body: ${{ steps.release-info.outputs.changelog }} diff --git a/scripts/get-changelog.mjs b/scripts/get-changelog.mjs new file mode 100755 index 00000000..31b2ece0 --- /dev/null +++ b/scripts/get-changelog.mjs @@ -0,0 +1,39 @@ +#!/usr/bin/env node +import * as path from 'node:path'; +import * as fs from 'node:fs'; +import { getScriptsDir } from './lib/util.mjs'; + +// Read Files +function readFile(...args) { + const __dirname = getScriptsDir(); + const root = path.join(__dirname, '..'); + return fs.readFileSync(path.join(root, ...args), 'utf8').trim(); +} +const version = readFile('VERSION'); +const changelog = readFile('docs', 'CHANGELOG.md'); + +// Print Version +console.log('version=' + version); + +// Parse Changelog +const out = []; +let foundStart = false; +const lines = changelog.split('\n'); +for (const line of lines) { + if (!foundStart) { + // Found Start Of Version Info + foundStart = line.includes(`**${version}**`); + } else if (line.trim().length === 0) { + // Found End + break; + } else { + // Found Entry + out.push(line); + } +} + +// Print +const delimiter = 'CHANGELOG_EOF'; +console.log('changelog<<' + delimiter); +console.log(out.join('\n')); +console.log(delimiter); \ No newline at end of file