Skip to content

Build source code and send to Capgo #2474

Build source code and send to Capgo

Build source code and send to Capgo #2474

Workflow file for this run

name: Build source code and send to Capgo
on:
push:
tags:
- '*'
jobs:
deploy:
runs-on: ubuntu-latest
name: "Build code and release"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/[email protected]
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Lint
id: lint_code
run: bun lint && bun lint-backend
- name: Build PROD
id: build_code
if: ${{ !contains(github.ref, '-alpha.') }}
run: bun mobile
env:
VITE_VAPID_KEY: ${{ secrets.VITE_VAPID_KEY }}
VITE_FIREBASE_CONFIG: ${{ secrets.VITE_FIREBASE_CONFIG }}
- name: Build ALPHA
id: build_code_alpha
if: ${{ contains(github.ref, '-alpha.') }}
run: bun dev-mobile
env:
VITE_VAPID_KEY: ${{ secrets.VITE_VAPID_KEY }}
VITE_FIREBASE_CONFIG: ${{ secrets.VITE_FIREBASE_CONFIG }}
- name: Install Supabase CLI
uses: supabase/setup-cli@v1
with:
version: 1.178.2
- name: Set env PROD
if: ${{ !contains(github.ref, '-alpha.') }}
run: echo "SUPABASE_DB_PASSWORD=${{ secrets.SUPABASE_DB_PASS }}" >> $GITHUB_ENV
- name: Set env ALPHA
if: ${{ contains(github.ref, '-alpha.') }}
run: echo "SUPABASE_DB_PASSWORD=${{ secrets.SUPABASE_DB_PASS_ALPHA }}" >> $GITHUB_ENV
- name: 🍜 Prepare Supabase PROD
run: supabase link --project-ref xvwzpoazmxkqosrdewyv
if: ${{ !contains(github.ref, '-alpha.') }}
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_TOKEN }}
- name: 🍜 Prepare Supabase ALPHA
run: supabase link --project-ref aucsybvnhavogdmzwtcw
if: ${{ contains(github.ref, '-alpha.') }}
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_TOKEN }}
# - name: 🚨 Seed Supabase ALPHA
# if: ${{ contains(github.ref, '-alpha.') }}
# run: supabase db reset --linked
- name: 🦤 Apply Supabase Migrations
run: supabase db push --include-all
- name: 🆙 Update functions
id: update_functions_prod
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_TOKEN }}
run: supabase functions deploy
- name: Deploy CF Worker
run: bunx wrangler@latest deploy --name capgo_api
if: ${{ !contains(github.ref, '-alpha.') }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Deploy CF Worker ALPHA
run: bunx wrangler@latest deploy --name capgo_api-alpha
if: ${{ contains(github.ref, '-alpha.') }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Publish CF webapp PROD
if: ${{ !contains(github.ref, '-alpha.') }}
run: bunx wrangler@latest pages deploy dist --project-name capgo-webapp --branch main
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Publish CF webapp ALPHA
if: ${{ contains(github.ref, '-alpha.') }}
run: bunx wrangler@latest pages deploy dist --project-name capgo-webapp-alpha --branch main
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Create Release ALPHA
if: ${{ contains(github.ref, '-alpha.') }}
id: create_release_alpha
run: bun x @capgo/cli@latest bundle upload -a ${{ secrets.CAPGO_TOKEN }} -c alpha
- name: Create Release PROD
if: ${{ !contains(github.ref, '-alpha.') }}
id: create_release_prod
run: bun x @capgo/cli@latest bundle upload -a ${{ secrets.CAPGO_TOKEN }} -c production
- name: Create Sourcemap Sentry
run: bun run cf-build
- name: Create Sentry ALPHA
if: ${{ contains(github.ref, '-alpha.') }}
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: staging
sourcemaps: dist_cf
version: ${{ github.ref }}
- name: Create Sentry release PROD
if: ${{ !contains(github.ref, '-alpha.') }}
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
sourcemaps: dist_cf
version: ${{ github.ref }}
build_android:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/[email protected]
with:
bun-version: latest
- name: Install dependencies
id: install_code
run: bun install
- name: Build
id: build_code
run: bun mobile
- name: Sync
id: sync_code
run: bun x cap sync
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Decode Keystore File
uses: timheuer/base64-to-file@v1
id: android_keystore
with:
fileName: "android_keystore.keystore"
encodedString: ${{ secrets.ANDROID_KEYSTORE_FILE }}
- name: Decode Google Play Confi File
uses: timheuer/base64-to-file@v1
id: service_account_json_file
with:
fileName: "serviceAccount.json"
encodedString: ${{ secrets.PLAY_CONFIG_JSON }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- uses: maierj/[email protected]
env:
KEYSTORE_PATH: ${{ steps.android_keystore.outputs.filePath }}
ANDROID_JSON_KEY_FILE: ${{ steps.service_account_json_file.outputs.filePath }}
DEVELOPER_PACKAGE_NAME: ${{ secrets.DEVELOPER_PACKAGE_NAME }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
with:
lane: android beta
- name: Upload release bundle
uses: actions/upload-artifact@v4
with:
name: android-release
path: ./android/app/build/outputs/bundle/release/app-release.aab
retention-days: 10
# build_ios:
# runs-on: macOS-latest
# steps:
# - uses: actions/checkout@v4
# - uses: pnpm/action-setup@v2
# with:
# version: 8
# - name: Use Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 18
# cache: 'pnpm'
# - name: Install dependencies
# id: install_code
# run: pnpm install --frozen-lockfile
# - uses: actions/cache@v3
# with:
# path: ios/App/Pods
# key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
# restore-keys: |
# ${{ runner.os }}-pods-
# - name: Build
# id: build_code
# run: pnpm mobile
# - name: Sync
# id: sync_code
# run: bun x @capacitor/cli cap sync
# - uses: ruby/setup-ruby@v1
# with:
# ruby-version: '2.7.2'
# - uses: maierj/[email protected]
# env:
# DEVELOPER_APP_IDENTIFIER: ${{ secrets.DEVELOPER_APP_IDENTIFIER }}
# DEVELOPER_APP_ID: ${{ secrets.DEVELOPER_APP_ID }}
# PROVISIONING_PROFILE_SPECIFIER: match AppStore ${{ secrets.DEVELOPER_APP_IDENTIFIER }}
# TEMP_KEYCHAIN_USER: ${{ secrets.TEMP_KEYCHAIN_USER }}
# TEMP_KEYCHAIN_PASSWORD: ${{ secrets.TEMP_KEYCHAIN_PASSWORD }}
# APPLE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }}
# APPLE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
# APPLE_KEY_CONTENT: ${{ secrets.APPSTORE_PRIVATE_KEY }}
# CERTIFICATE_STORE_URL: https://github.com/${{ secrets.CERTIFICATE_STORE_REPO }}.git
# GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
# GIT_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
# FASTLANE_APPLE_ID: ${{ secrets.FASTLANE_APPLE_ID }}
# MATCH_USERNAME: ${{ secrets.FASTLANE_APPLE_ID }}
# MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
# APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
# DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.DEVELOPER_PORTAL_TEAM_ID }}
# with:
# lane: closed_beta
# # subdirectory: 'ios'
# - name: Upload release bundle
# uses: actions/upload-artifact@v3
# with:
# name: ios-release
# path: ./App.ipa
# retention-days: 10