🏁 1 Prepare Release on Milestone Close #41
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: 🏁 1 Prepare Release on Milestone Close | |
| # Description: This workflow automatically prepares a release branch when a milestone is closed. | |
| # It extracts the milestone title as the version number and compiles release notes from | |
| # all issues and pull requests associated with the milestone. | |
| # | |
| # Triggers: | |
| # - Automatically when a milestone is closed | |
| # | |
| # Permissions: | |
| # - contents:write - Required to create GitHub releases | |
| # - issues:read - Required to read issue information for release notes | |
| # - pull-requests:write - Required to create pull requests | |
| # | |
| permissions: | |
| contents: write | |
| issues: read | |
| pull-requests: write | |
| on: | |
| milestone: | |
| types: [ closed ] | |
| jobs: | |
| release-preparation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: dev | |
| - name: Set up Git user | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "action@github.com" | |
| - name: Remove existing release branch if it exists | |
| run: | | |
| if git ls-remote --exit-code --heads origin release/${{ github.event.milestone.title }}; then | |
| git push origin --delete release/${{ github.event.milestone.title }} | |
| fi | |
| - name: Create release branch | |
| run: git checkout -b release/${{ github.event.milestone.title }} | |
| - name: Replace SmartHopperPublicKey with placeholder | |
| run: | | |
| csproj="src/SmartHopper.Infrastructure/SmartHopper.Infrastructure.csproj" | |
| placeholder="This value is automatically replaced by the build tooling before official builds." | |
| if [ -f "$csproj" ]; then | |
| if grep -q "<SmartHopperPublicKey>" "$csproj"; then | |
| sed -i "s#<SmartHopperPublicKey>.*</SmartHopperPublicKey>#<SmartHopperPublicKey>${placeholder}</SmartHopperPublicKey>#" "$csproj" | |
| else | |
| echo "SmartHopperPublicKey property not found in $csproj" | |
| fi | |
| else | |
| echo "File not found: $csproj" >&2 | |
| exit 1 | |
| fi | |
| - name: Update version in Solution.props | |
| uses: ./.github/actions/versioning/update-version | |
| with: | |
| new-version: ${{ github.event.milestone.title }} | |
| - name: Include missing issues in changelog | |
| uses: ./.github/actions/documentation/update-changelog-issues | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| days-lookback: 90 | |
| - name: Update changelog section | |
| uses: ./.github/actions/documentation/update-changelog | |
| with: | |
| action: create-release | |
| version: ${{ github.event.milestone.title }} | |
| - name: Update README badges | |
| uses: ./.github/actions/documentation/update-badges | |
| id: update-badges | |
| - name: Update Ready badge to YES (brightgreen) | |
| uses: ./.github/actions/documentation/update-ready-badge | |
| with: | |
| status: YES | |
| color: brightgreen | |
| file: README.md | |
| # - name: Fix code style | |
| # uses: ./.github/actions/code-style | |
| # with: | |
| # mode: fix | |
| # commit: false | |
| - name: Commit and push changes | |
| run: | | |
| git add Solution.props CHANGELOG.md README.md src/SmartHopper.Infrastructure/SmartHopper.Infrastructure.csproj | |
| git commit -m "chore: prepare release ${{ github.event.milestone.title }} with version update and code style fixes" | |
| git push origin release/${{ github.event.milestone.title }} | |
| - name: Create Pull Request | |
| id: create-pr | |
| run: | | |
| gh pr create \ | |
| --base dev \ | |
| --head release/${{ github.event.milestone.title }} \ | |
| --title "chore: prepare release ${{ github.event.milestone.title }} with version update and code style fixes" \ | |
| --body $'This PR prepares the release for version ${{ github.event.milestone.title }} with version update and code style fixes:\n\n- Updated version in Solution.props\n- Updated changelog with closed-solved issues\n- Updated README badges' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |