build: update workflow [release] v1.0.0 #10
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 & Release IgnoreMessages | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| commit_msg: ${{ steps.commit.outputs.message }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get commit message | |
| id: commit | |
| run: | | |
| MSG="$(git log -1 --pretty=%B)" | |
| echo "message<<EOF" >> $GITHUB_OUTPUT | |
| echo "$MSG" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Extract version from commit message | |
| id: version | |
| run: | | |
| MSG="${{ steps.commit.outputs.message }}" | |
| if [[ "$MSG" =~ \[release\][[:space:]]*v([0-9]+\.[0-9]+\.[0-9]+) ]]; then | |
| VERSION="${BASH_REMATCH[1]}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| else | |
| echo "No [release] vX.Y.Z found — skipping build." | |
| exit 1 | |
| fi | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Restore | |
| run: dotnet restore IgnoreMessages.csproj | |
| - name: Build | |
| run: dotnet build IgnoreMessages.csproj -c Release --no-restore | |
| - name: Publish / Build zip | |
| run: | | |
| dotnet publish IgnoreMessages.csproj \ | |
| -c Release \ | |
| /p:Version=${{ steps.version.outputs.version }} | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: IgnoreMessages-${{ steps.version.outputs.version }} | |
| path: | | |
| **/*.zip | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: IgnoreMessages-${{ needs.build.outputs.version }} | |
| path: artifacts | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.build.outputs.version }} | |
| name: IgnoreMessages v${{ needs.build.outputs.version }} | |
| prerelease: false | |
| files: artifacts/**/*.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |