Implement Pre-Authenticated URL #121
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: CI | |
on: | |
push: | |
branches: | |
- '*' | |
- '!gh-pages' | |
pull_request: | |
branches: | |
- '*' | |
- '!gh-pages' | |
jobs: | |
gh-pages: | |
runs-on: macos-12 | |
needs: ["app"] | |
steps: | |
# The default Java on macos-12 is 8, we need 17 | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#java | |
- name: Set java version | |
run: | | |
echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- run: make docs | |
- name: Deploy docs to gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./build/dokka/htmlMultiModule | |
test: | |
runs-on: macos-12 | |
steps: | |
# The default Java on macos-12 is 8, we need 17 | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#java | |
- name: Set java version | |
run: | | |
echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- name: Build sdk | |
run: ./gradlew sdk:assembleRelease | |
- name: Build sdk-okhttp | |
run: ./gradlew sdk-okhttp:assembleRelease | |
app: | |
runs-on: macos-12 | |
needs: ["test"] | |
if: github.ref == 'refs/heads/main' | |
env: | |
# The version depends on the Android Gradle Plugin version in /build.gradle.kts | |
BUILD_TOOLS_VERSION: "33.0.1" | |
steps: | |
# The default Java on macos-12 is 8, we need 17 | |
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#java | |
- name: Set java version | |
run: | | |
echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "18.x" | |
- run: npm install -g appcenter-cli | |
- name: Set versionCode | |
run: | | |
VERSION_CODE=$(date +%s) | |
sed -I "" "s/versionCode = 1/versionCode = $VERSION_CODE/" ./javasample/build.gradle.kts | |
- name: Build unsigned APK | |
run: ./gradlew javasample:assembleRelease | |
- name: Install keystore | |
env: | |
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
run: | | |
KEYSTORE_PATH=$RUNNER_TEMP/keystore.jks | |
echo -n "$ANDROID_KEYSTORE_BASE64" | base64 --decode -o $KEYSTORE_PATH | |
- name: Run zipalign | |
run: | | |
"$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/zipalign" -c -v 4 ./javasample/build/outputs/apk/release/javasample-release-unsigned.apk | |
- name: Run apksigner | |
env: | |
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
run: | | |
"$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/apksigner" sign \ | |
--ks $RUNNER_TEMP/keystore.jks \ | |
--ks-key-alias "$ANDROID_KEY_ALIAS" \ | |
--ks-pass "pass:$ANDROID_KEYSTORE_PASSWORD" \ | |
--key-pass "pass:$ANDROID_KEY_PASSWORD" \ | |
--out ./javasample/build/outputs/apk/release/javasample-release-signed.apk \ | |
./javasample/build/outputs/apk/release/javasample-release-unsigned.apk | |
- name: Distribute to App Center | |
env: | |
APPCENTER_ACCESS_TOKEN: ${{ secrets.ANDROID_APPCENTER_ACCESS_TOKEN }} | |
run: appcenter distribute release --debug --silent --file ./javasample/build/outputs/apk/release/javasample-release-signed.apk --group "Collaborators" --app "Oursky/Authgear-demo-Android" --release-notes "no release notes" |