Support trusting Aspire-mapped ASP.NET Core dev certs (SBA as native app) #73
Workflow file for this run
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 UAA Server | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - '.github/workflows/build_uaa_server.yaml' | |
| - 'uaa-server/**' | |
| - 'build.ps1' | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.github/workflows/build_uaa_server.yaml' | |
| - 'uaa-server/**' | |
| - 'build.ps1' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: 'write' | |
| env: | |
| IMAGE_NAME: uaa-server | |
| REGISTRY: ${{ vars.DOCKER_REGISTRY }} | |
| jobs: | |
| build-push: | |
| name: Build and push image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build Image | |
| run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}' | |
| shell: pwsh | |
| env: | |
| TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || '' }} | |
| - name: Login to container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ vars.DOCKER_REGISTRY }} | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Push image | |
| run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Post or update PR comment with image run instructions | |
| uses: actions/github-script@v7 | |
| if: ${{ github.event_name == 'pull_request' }} | |
| with: | |
| script: | | |
| const marker = '<!-- IMAGE_INSTRUCTIONS_UAA_SERVER -->'; | |
| const body = `${marker} | |
| To run the UAA server image built for this pull request: | |
| \`\`\`bash | |
| docker run --rm -d --pull=always -p 8080:8080 --name uaa-pr steeltoe.azurecr.io/uaa-server:pr-${{ github.event.number }} | |
| \`\`\``; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| per_page: 100, | |
| }); | |
| const existingComment = comments.find(comment => | |
| comment.user.login === 'github-actions[bot]' && comment.body.startsWith(marker) | |
| ); | |
| if (existingComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existingComment.id, | |
| body: body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: body, | |
| }); | |
| } |