Merge pull request #383 from selfdocumentingcode/bug/mleak #159
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 | |
| run-name: >- | |
| ${{ github.event_name == 'workflow_dispatch' && | |
| format ('Build triggered by @{0} on {1}', github.actor, github.ref_name) | |
| || null }} | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET Core | |
| uses: actions/setup-dotnet@v4 | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@v3 | |
| with: | |
| versionSpec: '6.0.x' | |
| - name: Execute GitVersion | |
| id: gitversion | |
| uses: gittools/actions/gitversion/execute@v3 | |
| with: | |
| useConfigFile: true | |
| - name: Display GitVersion config | |
| uses: gittools/actions/gitversion/command@v3 | |
| if: ${{ env.ACTIONS_RUNNER_DEBUG == 'true' }} | |
| with: | |
| arguments: '/showConfig' | |
| - name: Output the FullSemVer variable | |
| uses: gittools/actions/gitversion/command@v3.0.0 | |
| if: ${{ env.ACTIONS_RUNNER_DEBUG == 'true' }} | |
| with: | |
| arguments: '/showvariable FullSemVer' | |
| - name: Update the version number in the project files | |
| uses: gittools/actions/gitversion/command@v3.0.0 | |
| with: | |
| arguments: '/updateprojectfiles' | |
| - name: Test | |
| run: dotnet test --filter TestCategory\!=ShittyTests | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5.5.1 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }} | |
| type=raw,value=${{ steps.gitversion.outputs.semVer }} | |
| type=sha,format=long | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5.1.0 | |
| with: | |
| context: . | |
| file: ./src/Kattbot/prod.Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |