From 016877b07e97641ce5f70237ada9833b997dd62d Mon Sep 17 00:00:00 2001 From: Oscar Silver Date: Thu, 11 Aug 2022 16:02:54 +0200 Subject: [PATCH] Replace Travis with Github Actions (#46) --- .github/workflows/ci.yaml | 31 +++++++++++++++++++ .github/workflows/docs.yaml | 26 ++++++++++++++++ .travis.yml | 59 ------------------------------------- README.md | 2 +- webflows/build.gradle | 2 +- 5 files changed, 59 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/docs.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..643956df --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,31 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'adopt' + cache: gradle + - name: Build and test + run: ./gradlew build testRelease connectedCheck --exclude-task testDebugUnitTest + - name: Release and publish SDK + if: success() && startsWith(github.ref, 'refs/tags/') + run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository + env: + ORG_GRADLE_PROJECT_sonatypeUsername: samuelg + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEPASSWORD }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000..09d14464 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,26 @@ +name: Update documentation +on: + push: + branches: + - master +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'adopt' + cache: gradle + - name: Generate documentation + run: | + ./gradlew dokkaHtml && + mkdir docs && + cp -r webflows/build/dokka/html/. docs/. + - name: Deploy documentation + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6a128309..00000000 --- a/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -language: android -dist: trusty -jdk: openjdk11 - -android: - components: - - build-tools-29.0.3 - -env: - global: - # GH_TOKEN - - secure: "n7blhZYs6/0J+1q/MP0U9aOTuWUxLDwg+O08km4H1dVIMMCx0POTyNW7kLQ1m0oAcBateMFStRpuBAObR5h6SgWDC50SbKYjWaeZrqrA0EKpd5yAsXSbg6y5F8jobogd2kfyHJtgdPU5laysfw0jVOl8Vt3WwXP0JnfNT2fzSSv6B/scDnkFj0XjuOLRMW508L8JYY6d9J3kXXvOIt14M0hGUGbC+h7zFArRgwfXnPjNZ1cWrXXqjOe9fjHkwRGJ3QnwQxsiM6M3JTLtGk3SSyJMyNI7CTGH9M5jpZzcd3TkRkS26Evx8dnUENH5giB9cFpSgnRR5dW/UykxMlamlgEIdMgKepjWRbWR8uks1FP9pl1Q6Bw8dBMUr8baWq41Z65cD8ucyNhcUfsGIaJoPxKVBF0gke8NWNlbOW7Auo1mBxpxRJ2X/U3N0zniij7zz4MFdo1fTHb1jY7G9UFchWDnT9Moi97mv5+vzL+R1R0EIsUE9DrrjPeaC/lNTFp4kVUdUbZT91kce1CP2XQfQ8WGfwI0V8E1mzj8/0VoXyKj7XZIf7x3mZALSPNyYWc8pzIScsrPBB0ZTLKeWY3iKGTzzWz4lZ9e9P8FBsStxCV8tiQkJLd9hgNtvReVFBpSGMXZnzlI3quW38YaX0m8IgendFs9gmeYKiTmZJMUgSs=" - - ORG_GRADLE_PROJECT_sonatypeUsername=samuelg - # Encrypted ORG_GRADLE_PROJECT_sonatypePassword - - secure: "LNlry39I/iQt/3vR31WHhg33w1amttlzcpKE4zIb5V2bDcQ9aTHiqNKdmUyx2DmGxVtEFc5zuZUbbnwi+sGJjLronbqS0Rt8Ol9IkCZm9Hs6zmql9y8wh3OgwyXMuZaEpojJtGI0FR0MH9cAC1f/gXf684Zf+r3axQiZX8OvIRgCf1mLR8dfnM1ul46wYu0A0moW0qrOiZnFDkxxhgXjczgRzEp0ErNfv6waRifX230h/fm9sKA3o6tpaw76njZ+WEQGEvYM73VuREcwU9DI2qj3/8JS4LtQcACwvT5T8YVA8QnctL+3MdVVcdnCixT0ZDz6iU2rKvq7H7LQ80WlbLC0l4oa5Q6GGk/GUVMutxiBhHm/gm7czbgUA9HCuKWctZFgjW9JRQbcP/YHislFZ1UzeahtotsX2LJIsprqlL7UTSL9w0Khxj7pAbMqbsns+xzIQl/GfkKJOSxhrr7tGilXmm9SLY+HQV1Vet04fy/L3yZToxmkfA61vsWF+wuCZc1axOdldFiumuzNSbqPIiCP4sv74a0GTBpZG++RtM8vjTY22gUOdfIYAJTuhZLe1q3wwjQ4GMEjuvCbTxAzzY8t01Ld1SanAidVzPeKdb4Qjj8Ic46tfUfGz3eccJljSJovfEWlULMhILHq6p0N/rbmQnSYSKNuiNhU7w65Olw=" - -before_install: - # @todo https://github.schibsted.io/spt-identity/t/issues/1672 - - touch $HOME/.android/repositories.cfg - - wget "https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip" -O commandlinetools.zip - - unzip commandlinetools.zip -d $ANDROID_HOME/ - - yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager "platforms;android-29" --sdk_root=$ANDROID_HOME - - yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager "build-tools;29.0.3" --sdk_root=$ANDROID_HOME - -script: ./gradlew build testRelease connectedCheck --exclude-task testDebugUnitTest - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - -before_deploy: - - > - if ! [ "$BEFORE_DEPLOY_RUN" ]; then - export BEFORE_DEPLOY_RUN=1 - ./gradlew dokkaHtml - mkdir docs - cp -r webflows/build/dokka/html/. docs/. - fi - -deploy: - - provider: pages - skip_cleanup: true - github_token: $GH_TOKEN - verbose: true - local_dir: docs - on: - repo: schibsted/account-sdk-android-web - branch: master - - - provider: script - skip_cleanup: true - script: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository - on: - repo: schibsted/account-sdk-android-web - tags: true diff --git a/README.md b/README.md index ccdf9a2a..d76deb46 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Schibsted account Android SDK -[![Build Status](https://app.travis-ci.com/schibsted/account-sdk-android-web.svg?branch=master)](https://app.travis-ci.com/schibsted/account-sdk-android-web) +![Build Status](https://github.com/schibsted/account-sdk-android-web/actions/workflows/ci.yaml/badge.svg) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/schibsted/account-sdk-android-web) ![Platform](https://img.shields.io/badge/Platform-Android%2021%2B-orange.svg?style=flat) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/schibsted/account-sdk-android-web/blob/master/LICENSE) diff --git a/webflows/build.gradle b/webflows/build.gradle index ff1afe9d..4007dc2c 100644 --- a/webflows/build.gradle +++ b/webflows/build.gradle @@ -146,6 +146,6 @@ static String base64Decode(String envVar) { } signing { - useInMemoryPgpKeys(System.getenv('SIGNING_KEY_ID'), base64Decode('SIGNING_KEY'), base64Decode('SIGNING_PASSWORD')) + useInMemoryPgpKeys(base64Decode('SIGNING_KEY'), base64Decode('SIGNING_PASSWORD')) sign publishing.publications }