From 1d7b0d57a00c91c14934f902143c5439a9c9ec91 Mon Sep 17 00:00:00 2001 From: jiikko Date: Sun, 23 Apr 2023 10:29:07 +0900 Subject: [PATCH] update deployment status on deploy --- .github/workflows/deploy_to_production.yml | 37 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy_to_production.yml b/.github/workflows/deploy_to_production.yml index e5048b94..cc9c9616 100644 --- a/.github/workflows/deploy_to_production.yml +++ b/.github/workflows/deploy_to_production.yml @@ -13,6 +13,17 @@ env: REPOSITORY_NAME: pbm-cloud jobs: + create_deployment: + runs-on: ubuntu-latest + steps: + - uses: chrnorm/deployment-action@v2 + name: Create GitHub deployment + id: deployment + with: + token: '${{ github.token }}' + environment-url: https://pbm-cloud-dev.jiikko.com/ + environment: production + build: runs-on: ubuntu-latest steps: @@ -76,7 +87,7 @@ jobs: --allow-unauthenticated publish: - needs: deploy + needs: [build, deploy] runs-on: ubuntu-latest steps: - name: Add SHORT_SHA env property with commit short sha @@ -98,10 +109,22 @@ jobs: --to-tags="master-${SHORT_SHA}=100" \ --region="asia-northeast1" - - uses: chrnorm/deployment-action@v2 - name: Create GitHub deployment - id: deployment + update_deployment_status: + needs: [build, deploy, publish] + if: always() + runs-on: ubuntu-latest + steps: + - name: Update deployment status (failure) + if: failure() + uses: chrnorm/deployment-status@v2 with: - token: '${{ github.token }}' - environment-url: https://pbm-cloud-dev.jiikko.com/ - environment: production + token: ${{ github.token }} + state: 'failure' + deployment-id: ${{ steps.deployment.outputs.deployment_id }} + - name: Update deployment status (success) + if: success() + uses: chrnorm/deployment-status@v2 + with: + token: ${{ github.token }} + state: 'success' + deployment-id: ${{ steps.deployment.outputs.deployment_id }}