DRAFT: feat: setup GitHub actions fastlane #5
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: Build release without signing - Android and iOS | |
on: | |
pull_request: | |
branches: ['main'] | |
jobs: | |
build-android: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: 'Create .env file' | |
run: | | |
touch .env | |
echo OPEN_WEATHER_API_KEY=${{ secrets.OPEN_WEATHER_API_KEY }} >> .env | |
echo OPEN_WEATHER_BASE_URL=${{ secrets.OPEN_WEATHER_BASE_URL }} >> .env | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22 | |
cache: 'yarn' | |
- name: Gradle cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} | |
- name: Cache Yarn dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
**/node_modules | |
!**/node_modules/.cache | |
**/yarn.lock | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Cache Ruby dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Install dependencies | |
run: yarn | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3.4 | |
bundler: 2.5.11 | |
- name: Setup Java environment | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Install dependencies | |
run: | | |
gem install bundler | |
bundle install | |
- name: Run Fastlane | |
run: yarn fastlane:build:android | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: android-release-app | |
path: android/app/build/outputs/apk/release/app-release.apk | |
build-ios: | |
runs-on: macos-latest | |
environment: production | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- uses: actions/cache@v2 | |
with: | |
path: ios/Pods | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: 'Create .env file for iOS' | |
run: | | |
touch .env | |
echo OPEN_WEATHER_API_KEY=${{ secrets.OPEN_WEATHER_API_KEY }} >> .env | |
echo OPEN_WEATHER_BASE_URL=${{ secrets.OPEN_WEATHER_BASE_URL }} >> .env | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3.4 | |
bundler: 2.5.11 | |
- name: Cache Ruby dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Install dependencies | |
run: | | |
gem install bundler | |
bundle install | |
- name: Install Dependencies | |
run: yarn bootstrap | |
- name: Run Fastlane for iOS | |
run: yarn fastlane:build:ios |