From a3bb82ec23034238171033f0a905d722c9d46aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karolis=20Vy=C4=8Dius?= Date: Mon, 24 Jul 2023 15:19:23 +0300 Subject: [PATCH] Create sentry release --- .github/workflows/biip-deploy.yml | 43 +++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/workflows/biip-deploy.yml b/.github/workflows/biip-deploy.yml index 63ab541..a89434f 100644 --- a/.github/workflows/biip-deploy.yml +++ b/.github/workflows/biip-deploy.yml @@ -40,6 +40,11 @@ on: required: false type: number default: 15 + sentry-project: + description: "Optional input to set sentry project" + required: false + type: string + default: "" secrets: BIIP_TRIGGER_DEPLOY_ORGANIZATION: @@ -57,6 +62,12 @@ on: BIIP_TRIGGER_DEPLOY_WORKFLOW_FILE_NAME: description: "Required secret to set trigger workflow file name" required: true + BIIP_SENTRY_AUTH_TOKEN: + description: "Required secret to set sentry auth token" + required: true + BIIP_SENTRY_URL: + description: "Required secret to set sentry url" + required: true jobs: docker-trigger-deploy: @@ -70,6 +81,19 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - id: environment + uses: ASzc/change-string-case-action@v5 + with: + string: ${{ inputs.environment }} + + - name: Generate version + id: version + run: echo "version=${version}" >> "$GITHUB_OUTPUT" + env: + version: ${{ startsWith(github.ref, 'refs/tags/') && github.ref || github.sha }} - name: Get Token id: get_workflow_token @@ -87,7 +111,10 @@ jobs: docker-image: ${{inputs.docker-image}} registry-password: ${{secrets.GITHUB_TOKEN}} environment: ${{inputs.environment}} - build-args: ${{inputs.build-args}} + build-args: | + VERSION=${{ steps.version.outputs.version }} + ENVIRONMENT=${{ steps.environment.outputs.lowercase }} + ${{inputs.build-args}} docker-context: ${{inputs.docker-context}} docker-platforms: ${{inputs.docker-platforms}} @@ -98,4 +125,16 @@ jobs: repo: ${{secrets.BIIP_TRIGGER_DEPLOY_REPOSITORY}} github_token: ${{ steps.get_workflow_token.outputs.token }} workflow_file_name: ${{secrets.BIIP_TRIGGER_DEPLOY_WORKFLOW_FILE_NAME}} - client_payload: '{"environment": "${{inputs.environment}}"}' \ No newline at end of file + client_payload: '{"environment": "${{inputs.environment}}"}' + + - name: Create Sentry release + uses: getsentry/action-release@v1 + if: inputs.sentry-project != '' + env: + SENTRY_AUTH_TOKEN: ${{ secrets.BIIP_SENTRY_AUTH_TOKEN }} + SENTRY_URL: ${{ secrets.BIIP_SENTRY_URL }} + SENTRY_ORG: 'biip' + SENTRY_PROJECT: ${{ inputs.sentry-project}} + with: + environment: ${{ steps.environment.outputs.lowercase }} + version: ${{ steps.version.outputs.version }}