name: .NETon:push:branches: [ master ]pull_request:branches: [ master ]jobs:build:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v2- name: Setup .NETuses: actions/setup-dotnet@v1with:dotnet-version: 5.0.x- name: Declare some variablesid: varsshell: bashrun: |echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"- name: Build Coderun: dotnet publish -o ./target- name: Set up Docker Buildxuses: docker/setup-buildx-action@v1- name: Login to Registryuses: docker/login-action@v1with:registry: ${{ secrets.REGISTRY_URL }}username: ${{ secrets.REGISTRY_USERNAME }}password: ${{ secrets.REGISTRY_TOKEN }}- name: Build and pushuses: docker/build-push-action@v2with:context: .push: trueplatforms: linux/amd64,linux/arm64tags: ccr.ccs.tencentyun.com/han_test/my-web-app:${{ steps.vars.outputs.sha_short }}
dockerfile file for use by the built action.FROM mcr.microsoft.com/dotnet/aspnet:5.0COPY ./target /appWORKDIR /appENTRYPOINT ["dotnet", "myWebApp.dll"]
commitId is used as the image tag, which makes it easier to confirm the runtime's application code version. If you don't need this, you can directly use the latest image tag.git rev-parse --short HEAD
- name: Login to Registryuses: docker/login-action@v1with:registry: ${{ secrets.REGISTRY_URL }}username: ${{ secrets.REGISTRY_USERNAME }}password: ${{ secrets.REGISTRY_TOKEN }}

Feedback