Fix: failure to build a sample app with stable flavors #182
Workflow file for this run
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 and test projects | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
# Run this job when new version has been released and available. | |
workflow_dispatch: | |
jobs: | |
sdk-build: | |
runs-on: ubuntu-latest | |
env: | |
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4g -XX:MaxMetaspaceSize=2g -Dkotlin.daemon.jvm.options=-Xmx1536m" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '17.x' | |
java-package: jdk | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Check sdk publications | |
run: ./scripts/verify-publications.bash sdk | |
- name: Check sdk-mock publications | |
run: ./scripts/verify-publications.bash sdkMock | |
- run: ./gradlew sdk:generateMetaDataJson | |
- run: | | |
ls -R ~/.m2/repository | |
mkdir -p tmp/artifacts | |
cp -r ~/.m2/repository/com/deploygate/* tmp/artifacts/ | |
cp sdk/build/generated-sdk-metadata/sdk-meta-data-* tmp/artifacts/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: tmp/artifacts | |
retention-days: 3 | |
if-no-files-found: error | |
build-and-upload: | |
runs-on: ubuntu-latest | |
if: > | |
github.event_name != 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '17.x' | |
java-package: jdk | |
distribution: 'temurin' | |
cache: 'gradle' | |
- run: ./gradlew sample:bundleDevrealDebug sample:bundleDevrealRelease sample:bundleDevmockDebug sample:bundleDevmockRelease | |
- name: upload aab files | |
run: | | |
if [[ -z '${{ secrets.SHARED_DEPLOYGATE_APP_OWNER_NAME_FOR_PUBLIC_REPO }}' ]]; then | |
echo '::notice::contributors cannot upload files to deploygate' | |
exit 0 | |
fi | |
if [[ -z '${{ github.event.pull_request.number }}' ]]; then | |
distribution_name="canary" | |
else | |
distribution_name="sdk/pulls/${{ github.event.pull_request.number }}" | |
fi | |
while read -r aab_path; do | |
curl \ | |
-F file=@$aab_path \ | |
-F distribution_name="$distribution_name" \ | |
-H 'Authorization: token ${{ secrets.SHARED_DEPLOYGATE_API_TOKEN_FOR_PUBLIC_REPO }}' \ | |
--url 'https://deploygate.com/api/users/${{ secrets.SHARED_DEPLOYGATE_APP_OWNER_NAME_FOR_PUBLIC_REPO }}/apps' | \ | |
jq -r '"\(.results.package_name) \(.results.distribution.url)"' | |
done < <(find ./sample/build/outputs/bundle -name "*.aab") | |
distribute-stable: | |
runs-on: ubuntu-latest | |
if: > | |
github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '17.x' | |
java-package: jdk | |
distribution: 'temurin' | |
cache: 'gradle' | |
- run: ./gradlew sample:bundleStablerealDistribute sample:bundleStablemockDistribute | |
- name: upload aab files | |
run: | | |
distribution_name="deploygate-sdk-sample" | |
while read -r aab_path; do | |
curl \ | |
-F file=@$aab_path \ | |
-F distribution_name="$distribution_name" \ | |
-H 'Authorization: token ${{ secrets.SHARED_DEPLOYGATE_API_TOKEN_FOR_PUBLIC_REPO }}' \ | |
--url 'https://deploygate.com/api/users/${{ secrets.SHARED_DEPLOYGATE_APP_OWNER_NAME_FOR_PUBLIC_REPO }}/apps' | \ | |
jq -r '"\(.results.package_name) \(.results.distribution.url)"' | |
done < <(find ./sample/build/outputs/bundle -name "*.aab") |