From 6e999d47607e6d3d249f72e76b111220c3460fc1 Mon Sep 17 00:00:00 2001 From: Salam-vsem Date: Mon, 19 May 2025 14:51:39 +0300 Subject: [PATCH] add deploy.yml --- .gitea/workflows/deploy.yml | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..f2c64e8 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,62 @@ +name: release-tag + +on: + push: + branches: + - main + +jobs: + build-and-deploy: + runs-on: docker + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.DOCKER_REGISTRY }}/${{ github.event.repository.name }} + tags: | + type=semver,pattern={{version}} + type=sha + labels: | + org.opencontainers.image.source=${{ github.repository }} + org.opencontainers.image.revision=${{ github.sha }} + + - name: Log in to Docker registry + uses: docker/login-action@v3 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + target: basic + platforms: | + linux/amd64 + linux/arm64 + push: true + tags: | + ${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }} + ${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} + + - name: Trigger Dokploy Deployment + run: | + curl -X 'POST' \ + 'https://${{ env.DOKPLOY_DOMAIN }}/api/trpc/application.deploy' \ + -H 'accept: application/json' \ + -H 'x-api-key:${{ secrets.DOKPLOY_API_KEY }}' \ + -H 'Content-Type: application/json' \ + -d '{ + "json":{ + "applicationId": "${{ env.DOKPLOY_APPLICATION_ID }}" + } + }'