Merge pull request #902 from kienvo/fix-pipeline #220
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: Badge Magic CI | |
on: | |
push: | |
branches: [ development ] | |
pull_request: | |
branches: [ master, development ] | |
jobs: | |
build-android: | |
runs-on: ubuntu-latest | |
name: Android Build | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Grant permission for gradlew | |
run: chmod +x gradlew | |
- name: Syntax Check | |
run: ./gradlew spotlessCheck | |
- name: Build with Gradle | |
run: ./gradlew build --no-daemon --stacktrace | |
- name: Build app bundle release | |
run: ./gradlew bundleRelease | |
- name: Upload APK Debug | |
uses: actions/upload-artifact@v4 | |
with: | |
name: APK Debug generated | |
path: android/build/outputs/apk/debug | |
- name: Upload APK Release | |
uses: actions/upload-artifact@v4 | |
with: | |
name: APK Release generated | |
path: android/build/outputs/apk/release | |
- name: Upload AAB Release | |
uses: actions/upload-artifact@v4 | |
with: | |
name: AAB Release generated | |
path: android/build/outputs/bundle/release | |
- name: Upload APK to apk branch | |
run: | | |
git config --global user.name "${{ github.workflow }}" | |
git config --global user.email "gh-actions@${{ github.repository_owner }}" | |
git clone --branch=apk https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} apk | |
cd apk | |
if [[ ${{ github.ref_name }} =~ ^(master)$ ]]; then | |
rm -rf * | |
else | |
rm -rf badge-magic-dev* | |
fi | |
ls | |
find ../android/build/outputs -type f \( -name '*.apk' -o -name '*.aab' \) -exec cp -v {} . \; | |
for file in android*; do | |
mv $file badge-magic-development-${file#*-} | |
done | |
git checkout --orphan temporary | |
git add --all . | |
git commit -am "[Auto] Update Test Apk ($(date +%Y-%m-%d.%H:%M:%S))" | |
git branch -D apk | |
git branch -m apk | |
git push --force origin apk | |
build-ios: | |
runs-on: macos-latest | |
name: iOS Build | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: Pods | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- uses: actions/cache@v2 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Setup Fastlane | |
run: bundle install | |
- name: Install Swiftlint | |
run: brew install swiftlint || brew link --overwrite swiftlint | |
- name: Remove Project from Gradle Settings | |
run: echo "include ':BadgeMagicModule'" > settings.gradle | |
- name: Run Scripts | |
run: | | |
cd iOS | |
bundle exec fastlane run swiftlint strict:"true" | |
bundle exec fastlane gym --skip_codesigning --skip_archive --skip_package_ipa | |
cd .. | |