Merge pull request #3 from ricardona/users/ricardona/add-log-analytic… #21
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 deploy ASP.Net Core app to ACI | |
| on: | |
| push: | |
| paths: | |
| - "src/net-photo-gallery/**" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| # Sets the permissions granted to the GITHUB_TOKEN for the actions in this job. | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up .NET Core | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Build with dotnet | |
| run: dotnet build --configuration Release | |
| working-directory: 'src/net-photo-gallery' | |
| - name: dotnet publish | |
| run: dotnet publish -c Release -o publish | |
| working-directory: 'src/net-photo-gallery' | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build only (non-master branches) | |
| if: github.ref != 'refs/heads/master' | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: 'src/net-photo-gallery' | |
| push: false | |
| load: true | |
| tags: ghcr.io/${{ github.repository_owner }}/photogallery:latest | |
| - name: Build and push (master branch) | |
| if: github.ref == 'refs/heads/master' | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: 'src/net-photo-gallery' | |
| push: true | |
| tags: ghcr.io/${{ github.repository_owner }}/photogallery:latest |