From 4946ffea23e1dff980d99fd1477d18704bff2ab5 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Wed, 20 Dec 2023 02:59:54 +0100 Subject: [PATCH] Gh actions improvements (#20) Fixed sentry --- .github/workflows/main_deploy.yaml | 50 +++++++++++++++++++++--------- scripts/upload-sentry.sh | 11 ++++--- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main_deploy.yaml b/.github/workflows/main_deploy.yaml index 71e2b9306..202cb9d30 100644 --- a/.github/workflows/main_deploy.yaml +++ b/.github/workflows/main_deploy.yaml @@ -6,11 +6,10 @@ on: - main env: - # Setting an environment variable with the value of a configuration variable WEB_APP_ENV: ${{ vars.WEB_APP_ENV }} jobs: - deploy_web: + build_web: runs-on: ubuntu-latest environment: staging steps: @@ -27,7 +26,23 @@ jobs: run: ./scripts/prepare-web.sh - name: Build Release Web run: ./scripts/build-web.sh - - name: Build Website + - name: Upload files + uses: actions/upload-artifact@v3 + with: + name: web + path: build/web + + deploy_web: + runs-on: ubuntu-latest + needs: build_web + environment: staging + steps: + - name: Download web + uses: actions/download-artifact@v3 + with: + name: web + path: build/web + - name: Update Website files run: | mv build/web public touch public/.env @@ -43,16 +58,23 @@ jobs: update_sentry: runs-on: ubuntu-latest + needs: build_web + environment: staging + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_BASE_TOKEN: ${{ secrets.SENTRY_BASE_TOKEN }} + SENTRY_ORG: ${{ secrets.SENTRY_ORG }} + SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} + CI_COMMIT_SHA: ${{ github.sha }} steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Create Sentry release - uses: getsentry/action-release@v1 - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG }} - SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} + - uses: actions/checkout@v2 + - name: Download web + uses: actions/download-artifact@v3 with: - environment: staging + name: web + path: build/web + - name: Install sentry CLI + run: | + curl -sL https://sentry.io/get-cli/ | bash + - name: Update sentry + run: ./scripts/upload-sentry.sh diff --git a/scripts/upload-sentry.sh b/scripts/upload-sentry.sh index 569d1aad5..899a2312c 100755 --- a/scripts/upload-sentry.sh +++ b/scripts/upload-sentry.sh @@ -1,13 +1,14 @@ #!/bin/sh -ve # Build a release version of the app for a platform and upload symbols -OUTPUT_FOLDER_WEB=./build/web/ -SENTRY_RELEASE=$CI_COMMIT_SHA -SENTRY_PROJECT="client" -SENTRY_ORG="pangea-chat" +export OUTPUT_FOLDER_WEB=./build/web/ +export SENTRY_RELEASE=$CI_COMMIT_SHA +export SENTRY_PROJECT="${SENTRY_ORG:-client}" +export SENTRY_ORG="${SENTRY_ORG:-pangea-chat}" echo "[run] Uploading sourcemaps for $SENTRY_RELEASE" -sentry-cli releases new $SENTRY_RELEASE +echo "[run] $SENTRY_PROJECT @ $SENTRY_ORG / $OUTPUT_FOLDER_WEB" +sentry-cli releases new $SENTRY_RELEASE --org $SENTRY_ORG sentry-cli releases set-commits $CI_COMMIT_SHA --auto sentry-cli releases files $SENTRY_RELEASE upload-sourcemaps . \ --ext dart \