This repository has been archived by the owner on Aug 6, 2024. It is now read-only.
chore: add sentry tags for easier tracking of user info (#800) #382
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Staging | |
on: | |
push: | |
branches: | |
- master | |
# Ensure only a single job or workflow using the same concurrency group will run at a time | |
# When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, | |
# the queued job or workflow will be pending. | |
concurrency: | |
group: ${{ github.ref }} # The branch or tag ref that triggered the workflow run. | |
jobs: | |
markdown_lint: | |
name: Markdown Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: Install Packages | |
run: | | |
npm config set //npm.pkg.github.com/:_authToken $NPM_TOKEN | |
npm ci | |
env: | |
NPM_TOKEN: ${{ secrets.GH_TOKEN_SUPPLYALLY_BOT }} | |
- name: Check Markdown Lint | |
run: npm run markdown:lint | |
test: | |
name: Lint & Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: Cache Node Modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install Packages | |
run: | | |
npm config set //npm.pkg.github.com/:_authToken $NPM_TOKEN | |
npm ci | |
env: | |
NPM_TOKEN: ${{ secrets.GH_TOKEN_SUPPLYALLY_BOT }} | |
- name: Typecheck | |
run: npx --no-install tsc --noEmit | |
- name: Check Lint | |
run: npm run lint | |
- name: Set Timezone to +8 (Ubuntu) | |
run: sudo timedatectl set-timezone Asia/Singapore | |
- name: Test | |
run: npm run test -- --coverage | |
env: | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
APP_BUILD_VERSION: ${{ github.run_number }} | |
APP_BINARY_VERSION: "dev" | |
DOMAIN_FORMAT: ${{ secrets.TEST_DOMAIN_FORMAT }} | |
PROJECT_ID: ${{ secrets.EXPO_TEST_PROJECT_ID }} | |
OWNER: ${{ secrets.EXPO_TEST_OWNER }} | |
deploy_staging: | |
name: Deploy to Staging | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Fetch Tags | |
run: | | |
git fetch --prune --unshallow --tags -f | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- uses: expo/expo-github-action@v8 | |
with: | |
eas-version: 3.12.0 | |
expo-version: 6.3.9 | |
packager: npm | |
token: ${{ secrets.EXPO_TOKEN }} | |
eas-cache: true | |
expo-cache: true | |
- name: Install Packages | |
run: | | |
npm config set //npm.pkg.github.com/:_authToken $NPM_TOKEN | |
npm ci | |
env: | |
NPM_TOKEN: ${{ secrets.GH_TOKEN_SUPPLYALLY_BOT }} | |
- name: Get Latest Binary Version # Binary Version will be x.x.x based on the latest tag | |
id: latestBinaryVersion | |
run: | | |
# Release tag finds the latest tag in the tree branch - i.e. prod-x.x.x | |
RELEASE_TAG=$(echo $(git describe --tags --abbrev=0)) | |
# Using param substitution, we output x.x.x instead | |
echo "LATEST_BINARY_VERSION=${RELEASE_TAG#*-}" >> "$GITHUB_ENV" | |
- name: Echo Version Details | |
run: | | |
echo Build number is $GITHUB_RUN_NUMBER | |
echo Latest release is ${{ env.LATEST_BINARY_VERSION }} | |
- name: Get commit message | |
run: | | |
MSG=$(git log --format=%B -n 1 ${{github.event.after}}) | |
echo "COMMIT_MESSAGE=${MSG}" >> "$GITHUB_ENV" | |
- name: Eas Update Channel | |
env: | |
NODE_OPTIONS: --max_old_space_size=7168 | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
APP_BUILD_VERSION: ${{ github.run_number }} | |
APP_BINARY_VERSION: ${{ env.LATEST_BINARY_VERSION }} | |
DOMAIN_FORMAT: ${{ secrets.TEST_DOMAIN_FORMAT }} | |
PROJECT_ID: ${{ secrets.EXPO_TEST_PROJECT_ID }} | |
OWNER: ${{ secrets.EXPO_TEST_OWNER }} | |
run: | | |
.github/scripts/inject-token.sh | |
eas update --non-interactive --branch staging --message "${{ env.COMMIT_MESSAGE }}" | |
- name: Eas Update Storybook Channel | |
env: | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
APP_BUILD_VERSION: ${{ github.run_number }} | |
APP_BINARY_VERSION: ${{ env.LATEST_BINARY_VERSION }} | |
DOMAIN_FORMAT: ${{ secrets.TEST_DOMAIN_FORMAT }} | |
PROJECT_ID: ${{ secrets.EXPO_TEST_PROJECT_ID }} | |
OWNER: ${{ secrets.EXPO_TEST_OWNER }} | |
START_STORYBOOK: "true" | |
run: | | |
.github/scripts/inject-token.sh | |
eas update --non-interactive --branch storybook-staging --message "${{ env.COMMIT_MESSAGE }}" |