feat(release): test2 test on feature branch first, obviously #1
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: Build and Release WinForms App | |
| on: | |
| push: | |
| branches: | |
| - feature/github-action-release | |
| jobs: | |
| release: | |
| name: Create Release | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 4.7.x | |
| - name: Determine Next Version | |
| id: version | |
| run: | | |
| git fetch --tags | |
| $version = npx -y conventional-recommended-bump -p conventional-changelog-angular | |
| echo "New version: $version" | |
| echo "VERSION=$version" >> $GITHUB_ENV | |
| shell: pwsh | |
| - name: Update Version in AssemblyInfo | |
| run: | | |
| (Get-Content -Path "Properties/AssemblyInfo.cs") -replace 'AssemblyVersion\(".*?"\)', 'AssemblyVersion("${{ env.VERSION }}")' | Set-Content -Path "Properties/AssemblyInfo.cs" | |
| shell: pwsh | |
| - name: Build Solution | |
| run: dotnet build --configuration Release | |
| - name: Find Executable | |
| id: find_exe | |
| run: | | |
| $exePath = Get-ChildItem -Path . -Filter "*.exe" -Recurse | Where-Object { $_.FullName -match '\\bin\\Release\\' } | Select-Object -First 1 -ExpandProperty FullName | |
| echo "EXE_PATH=$exePath" >> $GITHUB_ENV | |
| echo "Found executable: $exePath" | |
| shell: pwsh | |
| - name: Generate Changelog | |
| run: npx conventional-changelog-cli -p angular -i CHANGELOG.md -s | |
| - name: Commit and Push Changelog | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add CHANGELOG.md | |
| git commit -m "chore(release): update changelog for v${{ env.VERSION }}" | |
| git tag v${{ env.VERSION }} | |
| git push origin master --tags | |
| shell: pwsh | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| name: Release v${{ env.VERSION }} | |
| body_path: CHANGELOG.md | |
| draft: false | |
| prerelease: false | |
| files: ${{ env.EXE_PATH }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |