diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2a6eac8..92a64e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,40 +1,45 @@ -name: Build Debug App +name: Build Release App on: - push: - branches: [main] - pull_request: - branches: [main] - workflow_dispatch: - -permissions: - contents: read + workflow_call: + secrets: + keyAlias: + required: true + keyPassword: + required: true + keystorePassword: + required: true + keystore: + required: true jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Setup JDK 21 - uses: actions/setup-java@v4 + - uses: actions/setup-java@v4 with: java-version: 21 distribution: zulu - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 - with: - cache-read-only: ${{ github.event_name == 'pull_request' }} + - uses: gradle/actions/setup-gradle@v4 - - name: Build with Gradle + - name: Build working-directory: Manager - run: ./gradlew :app:assembleDebug --stacktrace + env: + SIGNING_KEY_ALIAS: ${{ secrets.keyAlias }} + SIGNING_KEY_PASSWORD: ${{ secrets.keyPassword }} + SIGNING_STORE_PASSWORD: ${{ secrets.keystorePassword }} + SIGNING_STORE_FILE: ${{ github.workspace }}/release.keystore + RELEASE: true + run: | + echo "${{ secrets.keystore }}" | base64 -d > ${{ github.workspace }}/release.keystore + ./gradlew :app:packageRelease --stacktrace + rm ${{ github.workspace }}/release.keystore - - name: Upload artifacts - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v4 with: - name: app + name: rl-mobile-artifacts if-no-files-found: error - path: Manager/app/build/outputs/apk/debug/app-debug.apk + path: Manager/app/build/outputs/apk/release/app-release.apk diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4488dcd..ba716b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,65 +1,38 @@ -name: Build & Publish Release App +name: "[main] Release" on: push: - tags: [ "v*.*.*" ] - -concurrency: - group: "release" - cancel-in-progress: true - -permissions: - contents: write + branches: + - main + paths-ignore: + - "**/*.md" jobs: - publish: + Build: + uses: ./.github/workflows/build.yml + secrets: inherit + + Release: + name: Publish Release + needs: Build runs-on: ubuntu-latest + permissions: + contents: write steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup JDK 21 - uses: actions/setup-java@v4 + - name: Download artifacts + uses: actions/download-artifact@v4 with: - java-version: 21 - distribution: zulu + name: rl-mobile-artifacts + path: ./dist/ - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 + - name: Rename APK + run: mv ./dist/app-release.apk ./dist/rl-mobile-manager.apk + + - name: Publish release + uses: marvinpinto/action-automatic-releases@latest with: - cache-write-only: true - - - name: Build with Gradle - working-directory: Manager - env: - SIGNING_KEY_ALIAS: ${{ secrets.keyAlias }} - SIGNING_KEY_PASSWORD: ${{ secrets.keyPassword }} - SIGNING_STORE_PASSWORD: ${{ secrets.keystorePassword }} - SIGNING_STORE_FILE: ${{ github.workspace }}/release.keystore - RELEASE: true - run: | - echo "${{ secrets.keystore }}" | base64 -d > ${{ github.workspace }}/release.keystore - ./gradlew :app:packageRelease --stacktrace - rm ${{ github.workspace }}/release.keystore - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: app - if-no-files-found: error - path: Manager/app/build/outputs/apk/release/app-release.apk - - - name: Publish Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - tag="${{ github.ref_name }}" - apk_file="rl-mobile-manager-$tag.apk" - mv -T ./Manager/app/build/outputs/apk/release/app-release.apk "./$apk_file" - - gh release create "$tag" \ - --title "$tag" \ - --generate-notes \ - --verify-tag \ - --fail-on-no-commits \ - "./$apk_file" + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: latest + prerelease: false + title: Latest Release + files: ./dist/**