Release Drafter #198
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 Drafter | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| workflow_dispatch: | |
| jobs: | |
| draft-release: | |
| permissions: | |
| # write permission is required to create a github release | |
| contents: write | |
| # write permission is required for autolabeler | |
| # otherwise, read permission is required at least | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Extract default tool versions | |
| id: versions | |
| run: | | |
| # Get versions directly from versions.py (no package install needed) | |
| CLANG_FORMAT_VERSION=$(python3 -c "import sys; sys.path.insert(0, 'cpp_linter_hooks'); from versions import CLANG_FORMAT_VERSIONS; print(CLANG_FORMAT_VERSIONS[-1])") | |
| CLANG_TIDY_VERSION=$(python3 -c "import sys; sys.path.insert(0, 'cpp_linter_hooks'); from versions import CLANG_TIDY_VERSIONS; print(CLANG_TIDY_VERSIONS[-1])") | |
| # Export to GitHub Actions environment for subsequent steps | |
| echo "CLANG_FORMAT_VERSION=$CLANG_FORMAT_VERSION" >> $GITHUB_ENV | |
| echo "CLANG_TIDY_VERSION=$CLANG_TIDY_VERSION" >> $GITHUB_ENV | |
| # Log for debug | |
| echo "Default clang-format version: $CLANG_FORMAT_VERSION" | |
| echo "Default clang-tidy version: $CLANG_TIDY_VERSION" | |
| # Generate release notes file | |
| echo "## 💡 Default Clang Tool Version" > release_notes.md | |
| echo "clang-format: \`$CLANG_FORMAT_VERSION\` · clang-tidy: \`$CLANG_TIDY_VERSION\`" >> release_notes.md | |
| echo "" >> release_notes.md | |
| echo "You can override the default versions for by adding the \`--version\` argument under \`args\` in your pre-commit config. See [Custom Clang Tool Version](https://github.com/cpp-linter/cpp-linter-hooks?tab=readme-ov-file#custom-clang-tool-version) for details." >> release_notes.md | |
| echo "" >> release_notes.md | |
| cat release_notes.md | |
| # Export release notes content to env variable for Release Drafter | |
| echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV | |
| cat release_notes.md >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| # Draft your next Release notes as Pull Requests are merged into the default branch | |
| - uses: release-drafter/release-drafter@139054aeaa9adc52ab36ddf67437541f039b88e2 # v7.1.1 | |
| with: | |
| commitish: 'main' | |
| header: ${{ env.RELEASE_BODY }} | |
| config-name: github:cpp-linter/.github:/.github/release-drafter.yml | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |