refactor ci.yml

This commit is contained in:
meysamhadeli 2023-01-26 01:44:09 +03:30
parent 0fbade9d5a
commit 6263cbb75e

View File

@ -27,16 +27,6 @@ jobs:
key: ${{ runner.os }}-dotnet-nuget key: ${{ runner.os }}-dotnet-nuget
path: ~/.nuget/packages path: ~/.nuget/packages
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
if: ${{success()}}
run: dotnet test -c Release --no-restore
- name: Update Release Drafter - name: Update Release Drafter
if: | if: |
${{github.ref == 'refs/heads/main'}} && ${{github.ref == 'refs/heads/main'}} &&
@ -46,16 +36,30 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Print result"
run: |
echo "tag_name: ${{ steps.last_release.outputs.tag_name }}"
echo "branch: ${{ github.ref }}"
echo "branch: ${{ github.ref }}"
- name: Login to DockerHub - name: Login to DockerHub
if: | if: |
${{github.ref == 'refs/heads/main'}} && ${{ steps.last_release.outputs.tag_name }} != null
${{success()}} &&
${{ steps.last_release.outputs.tag_name }} != ''
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }} password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
if: ${{success()}}
run: dotnet test -c Release --no-restore
##ref: https://docs.docker.com/language/golang/configure-ci-cd/ ##ref: https://docs.docker.com/language/golang/configure-ci-cd/
##ref: https://event-driven.io/en/how_to_buid_and_push_docker_image_with_github_actions ##ref: https://event-driven.io/en/how_to_buid_and_push_docker_image_with_github_actions
- name: Build Docker Image - name: Build Docker Image