diff --git a/.forgejo/workflows/deploy-backend.yaml b/.forgejo/workflows/deploy-backend.yaml index a132d99d..b652a004 100644 --- a/.forgejo/workflows/deploy-backend.yaml +++ b/.forgejo/workflows/deploy-backend.yaml @@ -9,6 +9,11 @@ on: - 'Backend/**' workflow_dispatch: +env: + REGISTRY: ${{ vars.CONTAINER_REGISTRY }} + REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} + jobs: build: name: Build Backend Docker Image @@ -20,27 +25,26 @@ jobs: - name: Login to Docker Registry uses: docker/login-action@v3 with: - registry: ${{ vars.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + registry: ${{ env.REGISTRY }} + username: ${{ env.REGISTRY_USERNAME }} + password: ${{ env.REGISTRY_PASSWORD }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: config-inline: | - [registry."${{ vars.DOCKER_REGISTRY }}"] - http = true - insecure = true + [registry."${{ env.REGISTRY }}"] + ca=["/etc/ssl/certs/ca-certificates.crt"] - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: - images: ${{ vars.DOCKER_REGISTRY }}/elearning-backend + images: ${{ env.REGISTRY }}/elearning-backend tags: | type=ref,event=branch type=sha,prefix= - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/dev' }} - name: Build and push Docker image uses: docker/build-push-action@v5 @@ -57,7 +61,7 @@ jobs: name: Deploy Backend to Server runs-on: ubuntu-latest needs: build - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' + if: github.ref == 'refs/heads/dev' steps: - name: Remote Deploy uses: appleboy/ssh-action@v1.2.1