Skip to content

Commit

Permalink
chore: deploy actions (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignacio Santise authored Apr 9, 2024
1 parent f1c9ac0 commit fd42217
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI Setup
description: Setup Node.js and install dependencies

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn install --immutable
shell: bash
83 changes: 83 additions & 0 deletions .github/workflows/release-android.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
on:
workflow_call:
inputs:
name:
description: 'Name of the project to be released'
required: true
type: string
path:
description: 'Path of the project to be released'
required: true
type: string
type:
description: 'Release type of the project (debug/internal/production)'
default: 'internal'
type: string
output-path:
description: 'Path to get the APK file'
required: true
type: string
secrets:
project-id:
description: 'WalletConnect Cloud ID'
required: true
type: string
firebase-app-id:
required: true
type: string
firebase-token:
required: true
type: string
relay-url:
description: 'WalletConnect Relay URL'
required: false
type: string
sentry-dns:
required: true
type: string
sentry-file:
required: true
type: string
secrets-file:
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/ci-setup

- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: touch ${{ inputs.path }}/.env.${{ inputs.type }} && echo "ENV_PROJECT_ID=${{ secrets.project-id }}\nENV_RELAY_URL=${{ secrets.relay-url }}\nENV_SENTRY_DSN=${{ secrets.sentry-dns }}\nENV_SENTRY_TAG=${{ inputs.type }}" >> ${{ inputs.path }}/.env.${{ inputs.type }}
- run: touch ${{ inputs.path }}/android/sentry.properties && echo "${{ secrets.sentry-file }}" >> ${{ inputs.path }}/android/sentry.properties
- run: touch ${{ inputs.path }}/android/secrets.properties && echo "${{ secrets.secrets-file }}" >> ${{ inputs.path }}/android/secrets.properties

- name: Build APK
run: cd ${{ inputs.path }} && yarn install && yarn run android:build:internal

- name: Setup Firebase
uses: w9jds/setup-firebase@main
with:
tools-version: 13.0.1
firebase_token: ${{ secrets.firebase-token }}

- name: Upload APK
env:
APP_ID: ${{ secrets.firebase-app-id }}
run: |
firebase appdistribution:distribute ./android/app/build/outputs/apk/${{ inputs.output-path }} --app $APP_ID --release-notes "${{ inputs.name }} ${{ inputs.type }} release"
18 changes: 18 additions & 0 deletions .github/workflows/release-dapp-internal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release Web3Modal Android Internal
on: workflow_dispatch

jobs:
release-internal:
name: Release Web3Modal Android Internal
uses: ./.github/workflows/release-android.yaml
with:
path: 'dapps/W3MWagmi'
type: 'internal'
output-path: 'dapps/W3MWagmi/android/app/build/outputs/apk/internal/app-internal.apk'
secrets:
project-id: ${{ secrets.ENV_PROJECT_ID }}
sentry-dns: ${{ secrets.W3M_WAGMI_SENTRY_DSN }}
sentry-file: ${{ secrets.W3M_WAGMI_SENTRY_FILE }}
secrets-file: ${{ secrets.W3M_WAGMI_ANDROID_SECRETS }}
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
firebase-app-id: ${{ secrets.W3M_WAGMI_ANDROID_INTERNAL_FIREBASE_APP_ID }}
1 change: 1 addition & 0 deletions dapps/W3MWagmi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"android": "react-native run-android",
"android:build": "cd android && ./gradlew clean && ./gradlew assembleRelease",
"android:build:internal": "cd android && ./gradlew clean && ./gradlew assembleInternal",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
Expand Down

0 comments on commit fd42217

Please sign in to comment.