fix workflow image tags
This commit is contained in:
75
.github/workflows/ci.yml
vendored
Normal file
75
.github/workflows/ci.yml
vendored
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user