From 0edfddb4836aef3ad185e8fe261d64fb762886ea Mon Sep 17 00:00:00 2001 From: Space-Banane Date: Fri, 29 May 2026 19:30:11 +0200 Subject: [PATCH] fix workflow image tags --- .github/workflows/ci.yml | 75 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8e21c9b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +name: ci + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: install deps + run: pip install -e ".[dev]" + + - name: run tests + run: pytest -q + + push-image: + needs: test + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup buildx + uses: docker/setup-buildx-action@v3 + + - name: log in to harbor + uses: docker/login-action@v3 + with: + registry: registry.reversed.dev + username: ${{ secrets.HARBOR_USERNAME }} + password: ${{ secrets.HARBOR_PASSWORD }} + + - name: build and push image + uses: docker/build-push-action@v6 + with: + context: . + push: true + provenance: false + sbom: false + tags: | + registry.reversed.dev/registry/git-activity-merger:latest + registry.reversed.dev/registry/git-activity-merger:${{ github.sha }} + + deploy-coolify: + needs: push-image + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + steps: + - name: wait before redeploy + run: sleep 5 + + - name: Redeploy Coolify + run: | + response_file="$(mktemp)" + http_code="$(curl -sS -o "$response_file" -w "%{http_code}" -X GET "${{ secrets.COOLIFY_WEBHOOK }}" \ + -H "Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}")" + + echo "Coolify webhook HTTP status: $http_code" + echo "Coolify webhook response body:" + cat "$response_file" + + if [ "$http_code" -lt 200 ] || [ "$http_code" -ge 300 ]; then + echo "Redeploy request failed with non-2xx status." + exit 1 + fi