diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index cbd1958..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Build and Push to GHCR - -on: - push: - branches: [master] - paths: - - 'src/**' - - 'Dockerfile' - - 'package.json' - - 'bun.lock*' - - '.github/workflows/**' - workflow_dispatch: - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ghcr.io/mytheclipse/proxy-bun - -jobs: - build-and-push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=sha,prefix= - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Trigger deployment - uses: peter-evans/repository-dispatch@v3 - with: - token: ${{ secrets.DEPLOY_TOKEN }} - event-type: deploy - client-payload: '{"image_tag": "${{ steps.meta.outputs.version }}"}' diff --git a/.github/workflows/cloudflare.yml b/.github/workflows/cloudflare.yml deleted file mode 100644 index 1a8540a..0000000 --- a/.github/workflows/cloudflare.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Deploy to Cloudflare Workers - -on: - push: - branches: - - master - workflow_dispatch: - -jobs: - deploy: - name: Deploy to Cloudflare Workers - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v4 - - - name: Setup Bun - uses: oven-sh/setup-bun@v2 - with: - bun-version: latest - - - name: Install Dependencies - run: bun install --frozen-lockfile - - - name: Run Tests - run: bun test - - - name: Deploy Worker - uses: cloudflare/wrangler-action@v3 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - command: deploy - wranglerVersion: "4.110.0" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 914ba7c..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Deploy to VPS - -on: - repository_dispatch: - types: [deploy] - workflow_dispatch: - -env: - VPS_HOST: 45.127.35.244 - VPS_USER: root - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Setup SSH - uses: webfactory/ssh-agent@v0.9.0 - with: - ssh-private-key: ${{ secrets.VPS_SSH_KEY }} - - - name: Add VPS to known_hosts - run: | - mkdir -p ~/.ssh - ssh-keyscan -H ${{ env.VPS_HOST }} >> ~/.ssh/known_hosts - - - name: Pull and restart container - run: | - ssh ${{ env.VPS_USER }}@${{ env.VPS_HOST }} << 'DEPLOY_EOF' - set -e - IMAGE_TAG="${{ github.event.client_payload.image_tag }}" - IMAGE="ghcr.io/mytheclipse/proxy-bun:${IMAGE_TAG}" - - echo "=== Logging in to GHCR ===" - echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - echo "=== Pulling image: ${IMAGE} ===" - docker pull "${IMAGE}" - - echo "=== Updating docker-compose.yml ===" - cd /opt/edge-proxy - sed -i "s|image:.*|image: ${IMAGE}|" docker-compose.yml - - echo "=== Stopping old container ===" - docker compose down || true - - echo "=== Starting new container ===" - docker compose up -d - - echo "=== Waiting for health check ===" - sleep 5 - curl -sf http://localhost:3000/health || echo "Health check failed" - - echo "=== Deployment complete ===" - DEPLOY_EOF - - - name: Verify deployment - run: | - sleep 10 - curl -sf https://proxy.asepharyana.my.id/health || echo "External health check failed"