diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy-stage.yaml similarity index 57% rename from .gitea/workflows/deploy.yaml rename to .gitea/workflows/deploy-stage.yaml index b23552b..209708f 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy-stage.yaml @@ -6,7 +6,7 @@ on: [master, 'release/*'] jobs: - build_and_deploy: + build-and-deploy: runs-on: ubuntu-latest steps: @@ -16,13 +16,19 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to Docker Hub - run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Create nuget.config from secret + run: echo "${{ secrets.NUGET_CONFIG }}" > nuget.config - name: Build and push Docker image run: | - docker build --build-arg NUGET_USERNAME=${{ secrets.NUGET_USERNAME }} --build-arg NUGET_PASSWORD=${{ secrets.NUGET_PASSWORD }} -t ${{ secrets.DOCKER_USERNAME }}/mirea-bakend:latest . - docker push ${{ secrets.DOCKER_USERNAME }}/mirea-bakend:latest + docker build --build-arg NUGET_USERNAME=${{ secrets.NUGET_USERNAME }} --build-arg NUGET_PASSWORD=${{ secrets.NUGET_PASSWORD }} -t ${{ secrets.DOCKER_USERNAME }}/mirea-backend:latest . + docker push ${{ secrets.DOCKER_USERNAME }}/mirea-backend:latest - name: Start ssh-agent id: ssh-agent @@ -34,15 +40,15 @@ jobs: env: SSH_HOST: ${{ secrets.SSH_HOST }} SSH_USER: ${{ secrets.SSH_USER }} - DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/mirea-bakend:latest + DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/mirea-backend:latest run: | ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts ssh $SSH_USER@$SSH_HOST " docker pull $DOCKER_IMAGE && - docker stop mirea-bakend || true && - docker rm mirea-bakend || true && - docker run -d --name mirea-bakend -p 8085:8080 $DOCKER_IMAGE + docker stop mirea-backend || true && + docker rm mirea-backend || true && + docker run -d --name mirea-backend -p 8085:8080 $DOCKER_IMAGE " - name: Remove all keys from ssh-agent - run: ssh-add -D \ No newline at end of file + run: ssh-add -D diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml index e870ad0..8ee95ea 100644 --- a/.gitea/workflows/test.yaml +++ b/.gitea/workflows/test.yaml @@ -12,12 +12,12 @@ jobs: steps: - name: Checkout repository - - uses: actions/checkout@v4 + uses: actions/checkout@v4 - name: Set up .NET Core uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: '8.0.x' - name: Restore dependencies run: dotnet restore diff --git a/Backend.sln b/Backend.sln index aa0141f..5fe3b84 100644 --- a/Backend.sln +++ b/Backend.sln @@ -11,8 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elements of the solution", .env = .env .gitattributes = .gitattributes .gitignore = .gitignore + .gitea\workflows\deploy-stage.yaml = .gitea\workflows\deploy-stage.yaml Dockerfile = Dockerfile - .gitea\workflows\deploy.yaml = .gitea\workflows\deploy.yaml LICENSE.txt = LICENSE.txt README.md = README.md .gitea\workflows\test.yaml = .gitea\workflows\test.yaml