github action #2
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: React native ci-cd | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set current date as env variable | |
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Set repository name as env variable | |
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Install dependencies | |
run: yarn install | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
- name: Build Android APK | |
run: | | |
cd android | |
./gradlew assembleRelease | |
- name: Build Android AAB | |
run: | | |
cd android | |
./gradlew bundleRelease | |
- name: Upload APK Release - ${{ env.repository_name }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.date_today }} - ${{ env.repository_name }} - APK(s) release generated | |
path: android/app/build/outputs/apk/release/ | |
- name: Upload AAB (App Bundle) Release - ${{ env.repository_name }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.date_today }} - ${{ env.repository_name }} - App bundle(s) AAB release generated | |
path: android/app/build/outputs/bundle/release/ |