diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..381b0c1b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Build and Upload release + +on: + push: + tags: + - 'v*' + +jobs: + CI: + name: Build and Upload release + runs-on: ubuntu-latest + + env: + GOOGLE_SERVICE_KEY_JSON: ${{ secrets.GOOGLE_SERVICE_KEY_JSON }} + KEYSTORE_JKS: ${{ secrets.KEYSTORE_JKS }} + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} + KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }} + KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }} + TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }} + VERSION_TAG: ${{ github.ref_name }} + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup JDK + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2.3' + bundler-cache: true + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Generate google-service-key.json file + run: echo ${{secrets.GOOGLE_SERVICE_KEY_JSON}} | base64 -d > /home/runner/work/YouAMP/YouAMP/google-service-key.json + + - name: Generate .jks file + run: echo ${{secrets.KEYSTORE_JKS}} | base64 -d > /home/runner/work/YouAMP/YouAMP/keystore.jks + + - name: Publish github release with fastlane + run: bundle exec fastlane github \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..7a118b49 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 00000000..0579b7e5 --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,2 @@ +json_key_file("google-service-key.json") +package_name("ru.stersh.youamp") diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 00000000..e333f36a --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,24 @@ +default_platform(:android) + +platform :android do + desc "Lane for distributing app using Github releases" + lane :github do + gradle( + task: "assemble", + build_type: "Release", + properties: { + "android.injected.signing.store.file" => "/home/runner/work/YouAMP/YouAMP/keystore.jks", + "android.injected.signing.store.password" => ENV['KEYSTORE_PASSWORD'], + "android.injected.signing.key.alias" => ENV['KEYSTORE_KEY_ALIAS'], + "android.injected.signing.key.password" => ENV['KEYSTORE_KEY_PASSWORD'], + } + ) + set_github_release( + repository_name: "siper/YouAMP", + api_token: ENV['TOKEN_GITHUB'], + name: ENV['VERSION_TAG'], + tag_name: ENV['VERSION_TAG'], + upload_assets: ["app/build/outputs/apk/release/app-release.apk"] + ) + end +end diff --git a/gradlew b/gradlew old mode 100644 new mode 100755