Release 1.7.0 $schema added to json datafile
#9
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-slim | |
| 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 | |
| - 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 | |
| run: pwsh -NoProfile -File tests/run-tests.ps1 | |
| - name: Regenerate artifacts | |
| run: | | |
| pwsh tools/generate-delphi-compiler-versions-inc.ps1 -Force | |
| pwsh tools/generate-delphi-compiler-versions-pas.ps1 -Force | |
| pwsh tools/generate-platform-support-md.ps1 -Force | |
| - name: Extract version from tag | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| DATA_VERSION=$(jq -r '.dataVersion' data/delphi-compiler-versions.json) | |
| SCHEMA_VERSION=$(jq -r '.schemaVersion' data/delphi-compiler-versions.json) | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| echo "DATA_VERSION=${DATA_VERSION}" >> $GITHUB_ENV | |
| echo "SCHEMA_VERSION=${SCHEMA_VERSION}" >> $GITHUB_ENV | |
| - name: Populate release notes | |
| run: | | |
| 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; s/DATA_VERSION/${DATA_VERSION}/g; s/SCHEMA_VERSION/${SCHEMA_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 }} | |
| run: | | |
| gh release create "${GITHUB_REF_NAME}" \ | |
| --title "Delphi Compiler Versions v${VERSION}" \ | |
| --notes-file release-notes.md \ | |
| generated/DELPHI_COMPILER_VERSIONS.inc \ | |
| generated/DelphiCompilerVersions.pas \ | |
| generated/PlatformSupport.md \ | |
| data/delphi-compiler-versions.json |