diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 20dd9d6..461b392 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -35,3 +35,28 @@ jobs: - name: Run ESLint run: npx eslint assets/js/ + deploy: + name: Deploy + runs-on: ubuntu-latest + needs: [php-lint, js-lint] + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/development') + steps: + - name: Trigger webhook + env: + WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} + GIT_REF: ${{ github.ref }} + run: | + if [ "$GIT_REF" = "refs/heads/main" ]; then + HOOK_ID="tinker-deploy" + else + HOOK_ID="tinker-beta-deploy" + fi + PAYLOAD="{\"ref\":\"${GIT_REF}\"}" + SIG=$(echo -n "$PAYLOAD" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | awk '{print $2}') + curl -sf --connect-timeout 10 \ + -X POST \ + -H "Content-Type: application/json" \ + -H "X-Gitea-Signature: ${SIG}" \ + -d "$PAYLOAD" \ + "http://10.10.10.45:9000/hooks/${HOOK_ID}" +