Workflow file for this run
This file contains hidden or 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: Build Release APK | |
| on: | |
| release: | |
| types: [created] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if tag exists | |
| run: | | |
| TAG_NAME="${{ github.event.release.tag_name }}" | |
| if ! git rev-parse "$TAG_NAME" >/dev/null 2>&1; then | |
| echo "::error::Tag $TAG_NAME does not exist. Please create the tag first." | |
| exit 1 | |
| fi | |
| echo "Tag $TAG_NAME exists, proceeding with build..." | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - name: Extract version from release | |
| id: version | |
| run: | | |
| VERSION_TAG="${{ github.event.release.tag_name }}" | |
| VERSION_NAME="${VERSION_TAG#v}" | |
| VERSION_CODE=${{ github.run_number }} | |
| echo "version_tag=$VERSION_TAG" >> $GITHUB_OUTPUT | |
| echo "version_name=$VERSION_NAME" >> $GITHUB_OUTPUT | |
| echo "version_code=$VERSION_CODE" >> $GITHUB_OUTPUT | |
| - name: Grant execute permission for scripts | |
| run: | | |
| chmod +x ./gradlew | |
| chmod +x ./.github/scripts/generate_changelog.sh || true | |
| - name: Decode and setup keystore | |
| run: | | |
| echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > keystore.jks | |
| - name: Build Release APK | |
| env: | |
| KEYSTORE_FILE: ${{ github.workspace }}/keystore.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| run: | | |
| ./gradlew immich:assembleRelease \ | |
| -Pversion.name=${{ steps.version.outputs.version_name }} \ | |
| -Pversion.code=${{ steps.version.outputs.version_code }} | |
| - name: Generate changelog | |
| run: | | |
| ./.github/scripts/generate_changelog.sh > CHANGELOG.txt | |
| echo "Generated CHANGELOG.txt" | |
| - name: Rename APK | |
| run: | | |
| mv immich/build/outputs/apk/release/immich-release.apk \ | |
| immich/build/outputs/apk/release/immich-${{ steps.version.outputs.version_name }}.apk | |
| - name: Upload Release APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: immich-${{ steps.version.outputs.version_name }} | |
| path: immich/build/outputs/apk/release/immich-${{ steps.version.outputs.version_name }}.apk | |
| - name: Upload APK to Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| body_path: CHANGELOG.txt | |
| files: ${{ steps.find_apk.outputs.apk_path }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |