name: Build and Deploy Backend on: push: tags: - '*' workflow_dispatch: jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Gitea Container Registry uses: docker/login-action@v3 with: registry: git.uvpn.shop username: ${{ gitea.repository_owner }} password: ${{ secrets.ACCESS_TOKEN }} - name: Set repository name to lowercase id: repo run: | OWNER=$(echo "${{ gitea.repository_owner }}" | tr '[:upper:]' '[:lower:]') REPO=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]') echo "owner=$OWNER" >> $GITHUB_OUTPUT echo "repo=$REPO" >> $GITHUB_OUTPUT echo "full_repo=$OWNER/$REPO" >> $GITHUB_OUTPUT # Также сохраняем полный путь к образу echo "image=git.uvpn.shop/$OWNER/$REPO" >> $GITHUB_OUTPUT - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . push: true tags: | ${{ steps.repo.outputs.image }}:latest ${{ steps.repo.outputs.image }}:${{ gitea.ref_name }} cache-from: type=gha cache-to: type=gha,mode=max build-args: | BUILD_VERSION=${{ gitea.ref_name }} BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') VCS_REF=${{ github.sha }} - name: Create Gitea Release via API run: | TAG_MESSAGE=$(git tag -l --format='%(contents)' "${{ gitea.ref_name }}" 2>/dev/null || echo "Автоматический релиз через CI/CD") TAG_MESSAGE_ESCAPED=$(echo "$TAG_MESSAGE" | sed 's/"/\\"/g' | awk '{printf "%s\\n", $0}') JSON_PAYLOAD=$(cat <