Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/RELEASE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

**Tag:** `vX.Y.Z`

**Direct download:** [delphi-inspect.ps1](https://github.com/continuous-delphi/delphi-inspect/releases/download/vX.Y.Z/delphi-inspect.ps1)

This release improves `delphi-inspect`, a Continuous Delphi utility
that scans for installed Delphi compilers/toolchains and outputs
standardized, reliable metadata for use in CI environments, build
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Release

on:
push:
tags:
- 'v*'

concurrency:
group: tests-refs/heads/${{ github.event.repository.default_branch }}
cancel-in-progress: true

jobs:
release:
runs-on: windows-latest
permissions:
contents: write

steps:
# Tag validation runs before checkout -- no workspace is needed for this check.
# The glob above is intentionally loose; this step is the authoritative gate.
- name: Validate tag format
shell: bash
run: |
if [[ ! "${GITHUB_REF_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag '${GITHUB_REF_NAME}' does not match required format vX.Y.Z"
exit 1
fi

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Install Pester and PSScriptAnalyzer
run: |
pwsh -Command "Install-Module Pester -MinimumVersion 5.7.0 -Force -Scope CurrentUser"
pwsh -Command "Install-Module PSScriptAnalyzer -Force -Scope CurrentUser"

- name: Run tests
shell: pwsh
env:
TERM: dumb
NO_COLOR: "1"
run: |
$PSStyle.OutputRendering = 'PlainText'
./tests/run-tests.ps1

- name: Extract version from tag
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"

- name: Populate release notes
shell: bash
run: |
if [[ ! -f .github/RELEASE_TEMPLATE.md ]]; then
echo "ERROR: Missing .github/RELEASE_TEMPLATE.md"
exit 1
fi

CHANGELOG_SECTION=$(awk '/^## \['"${VERSION}"'\]/{found=1; next} /^## \[/{if(found) exit} found' CHANGELOG.md)

if [[ -z "${CHANGELOG_SECTION}" ]]; then
echo "ERROR: No entry for version ${VERSION} found in CHANGELOG.md"
exit 1
fi

sed "s/vX\.Y\.Z/v${VERSION}/g; s/X\.Y\.Z/${VERSION}/g" \
.github/RELEASE_TEMPLATE.md > release-notes.md

printf '\n---\n\n# Change Log\n\n%s\n' "${CHANGELOG_SECTION}" >> release-notes.md

- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
REPO_NAME="${GITHUB_REPOSITORY##*/}"
gh release create "${GITHUB_REF_NAME}" \
--title "${REPO_NAME} v${VERSION}" \
--notes-file release-notes.md \
source/delphi-inspect.ps1
Loading
Loading