refactor ci.yml

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

View File

@ -27,6 +27,29 @@ jobs:
key: ${{ runner.os }}-dotnet-nuget
path: ~/.nuget/packages
- name: Update Release Drafter
if: |
${{github.ref == 'refs/heads/main'}} &&
${{success()}}
id: last_release
uses: release-drafter/release-drafter@v5
env:
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
if: |
${{ steps.last_release.outputs.tag_name }} != null
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Restore dependencies
run: dotnet restore
@ -37,27 +60,8 @@ jobs:
if: ${{success()}}
run: dotnet test -c Release --no-restore
- name: Update Release Drafter
if: |
${{github.ref == 'refs/heads/main'}} &&
${{success()}}
id: last_release
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
if: |
${{github.ref == 'refs/heads/main'}} &&
${{success()}} &&
${{ steps.last_release.outputs.tag_name }} != ''
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
##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://docs.docker.com/language/golang/configure-ci-cd/
##ref: https://event-driven.io/en/how_to_buid_and_push_docker_image_with_github_actions
- name: Build Docker Image
if: |
${{github.ref == 'refs/heads/main'}} &&