From 915a466310c452baf4ac4ee896984f0b75da043c Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Sun, 31 May 2026 00:03:49 +0200 Subject: [PATCH] feat: use portainer hook instead of pushing image to gitea package repository --- .gitea/workflows/build.yml | 30 ------------------------------ .gitea/workflows/deploy.yml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 30 deletions(-) delete mode 100644 .gitea/workflows/build.yml create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml deleted file mode 100644 index b71455e..0000000 --- a/.gitea/workflows/build.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Build and Push Docker Image - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to Gitea Container Registry - uses: docker/login-action@v3 - with: - registry: git.pihkaal.me - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - - name: Build and push Docker image - run: | - docker build -t git.pihkaal.me/pihkaal/gitea-auto-urls:latest . - docker push git.pihkaal.me/pihkaal/gitea-auto-urls:latest diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..94c696c --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,33 @@ +name: Deploy + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image + run: docker build . + + deploy: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Redeploy Portainer stack + run: | + curl -X POST "${{ vars.PORTAINER_URL }}/api/stacks/${{ vars.PORTAINER_STACK_ID }}/git/redeploy?endpointId=${{ vars.PORTAINER_ENDPOINT_ID }}" \ + -H "X-API-Key: ${{ secrets.PORTAINER_API_KEY }}" \ + -H "Content-Type: application/json" \ + -d '{"pullImage": true}'