From a856eff4cad9db08fee96666d0f3f820fad5475e Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 9 Jun 2024 21:25:17 +0100 Subject: [PATCH] FEAT: Deployment status (#25) --- .github/workflows/deploy.yml | 46 ++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1d0ca99..d131f88 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,6 +9,8 @@ jobs: name: Deploy app runs-on: ubuntu-latest concurrency: deploy-group + permissions: + deployments: write steps: - name: Checkout 🛎ī¸ uses: actions/checkout@v4 @@ -16,41 +18,33 @@ jobs: - name: Setup Fly 🧰 uses: superfly/flyctl-actions/setup-flyctl@master - - name: Create GitHub Deployment 🐙 - id: create_deployment - uses: octokit/request-action@v2.3.1 + - name: Create GitHub deployment 🐙 + uses: chrnorm/deployment-action@v2 + id: deployment with: - route: POST /repos/${{ github.repository }}/deployments + token: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} + environment-url: http://api.web-check.xyz environment: production - ref: ${{ github.sha }} - description: "Deploying to Fly.io" - auto_merge: false - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} - name: Deploy to Fly.io 🛩ī¸ run: flyctl deploy --remote-only env: FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }} - - - name: Set deployment status to success ✅ + + - name: Update deployment status (success) ✅ if: success() - uses: octokit/request-action@v2.3.1 + uses: chrnorm/deployment-status@v2 with: - route: POST /repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.id }}/statuses - state: success - description: "✅ Deployment Succeeded đŸĨŗ" - environment: production - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} + environment-url: ${{ steps.deployment.outputs.environment_url }} + deployment-id: ${{ steps.deployment.outputs.deployment_id }} + state: 'success' - - name: Set deployment status to failure ❌ + - name: Update deployment status (failure) ❌ if: failure() - uses: octokit/request-action@v2.3.1 + uses: chrnorm/deployment-status@v2 with: - route: POST /repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.id }}/statuses - state: failure - description: "❌ Deployment Failed đŸ˜Ĩ" - environment: production - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} + environment-url: ${{ steps.deployment.outputs.environment_url }} + deployment-id: ${{ steps.deployment.outputs.deployment_id }} + state: 'failure'