-
Notifications
You must be signed in to change notification settings - Fork 8
107 lines (96 loc) · 3.73 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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@v4
- uses: actions/setup-java@v4
with:
java-version: '17.x'
java-package: jdk
distribution: 'temurin'
cache: 'gradle'
- uses: gradle/actions/setup-gradle@v3
- 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@v4
- uses: actions/setup-java@v4
with:
java-version: '17.x'
java-package: jdk
distribution: 'temurin'
cache: 'gradle'
- uses: gradle/actions/setup-gradle@v3
- 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@v4
- uses: actions/setup-java@v4
with:
java-version: '17.x'
java-package: jdk
distribution: 'temurin'
cache: 'gradle'
- uses: gradle/actions/setup-gradle@v3
- 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")