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 Publish | |
| on: | |
| push: | |
| branches: [ "master", "main" ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ "master", "main" ] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore ChuckieHelper.sln | |
| - name: Build | |
| run: dotnet build ChuckieHelper.sln --no-restore --configuration Release | |
| - name: Publish | |
| run: dotnet publish WebApplication1/ChuckieHelper.WebApi.csproj --no-build --configuration Release --output ./publish | |
| - name: Zip published app | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| cd publish | |
| zip -r ../ChuckieHelper.zip . | |
| cd .. | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: ChuckieHelper.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: published-app | |
| path: ./publish |