diff --git a/.github/workflows/build.yml b/.github/workflows/release.yml similarity index 62% rename from .github/workflows/build.yml rename to .github/workflows/release.yml index 2db3c43d..c54429f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,21 @@ -name: Build All Platforms +name: Release on: workflow_dispatch: + inputs: + release_type: + description: 'Release type' + required: true + type: choice + default: 'stable' + options: + - stable + - nightly + dry_run: + description: 'Dry run (build & upload artifacts only, skip creating release)' + required: false + type: boolean + default: false concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -74,6 +88,8 @@ jobs: name: Android needs: prepare-deps runs-on: ubuntu-latest + env: + GRADLE_FLAGS: ${{ inputs.release_type == 'nightly' && '-PversionName=nightly' || '' }} steps: - uses: actions/checkout@v4 @@ -97,8 +113,23 @@ jobs: - name: Set up Gradle uses: gradle/actions/setup-gradle@v4 + + - name: Decode keystore + run: | + echo '${{ secrets.KEYSTORE }}' | base64 --decode > "${{ github.workspace }}/composeApp/upload-keystore.jks" + + - name: Configure Android signing + working-directory: composeApp + run: | + cat >> local.properties <> "$GITHUB_OUTPUT" + echo "is_draft=true" >> "$GITHUB_OUTPUT" + echo "release_name=Spotube ${TAG}" >> "$GITHUB_OUTPUT" + else + TAG="nightly" + VERSION="$(date +%Y-%m-%d)" + echo "is_prerelease=true" >> "$GITHUB_OUTPUT" + echo "is_draft=false" >> "$GITHUB_OUTPUT" + echo "release_name=Nightly ${VERSION}" >> "$GITHUB_OUTPUT" + fi + echo "tag=${TAG}" >> "$GITHUB_OUTPUT" - - name: Upload .app - uses: actions/upload-artifact@v4 + - name: Download all artifacts + uses: actions/download-artifact@v4 + + - name: Generate release notes + run: | + echo "## Downloads" > release-notes.md + echo "" >> release-notes.md + for dir in android-apk android-aab linux-deb linux-rpm linux-appimage windows-msi windows-exe macos-dmg; do + if [ -d "$dir" ]; then + echo "### $dir" >> release-notes.md + for f in "$dir"/*; do + echo "- \`$(basename "$f")\`" >> release-notes.md + done + echo "" >> release-notes.md + fi + done + + - name: Create Release + uses: softprops/action-gh-release@v2 with: - name: ios-app - path: build/ios/*.app + tag_name: ${{ steps.vars.outputs.tag }} + name: ${{ steps.vars.outputs.release_name }} + body_path: release-notes.md + draft: ${{ steps.vars.outputs.is_draft }} + prerelease: ${{ steps.vars.outputs.is_prerelease }} + files: | + android-apk/*.apk + android-aab/*.aab + linux-deb/*.deb + linux-rpm/*.rpm + linux-appimage/*.AppImage + windows-msi/*.msi + windows-exe/*.exe + macos-dmg/*.dmg diff --git a/AGENTS.md b/AGENTS.md index 9f60b0d4..f9339626 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,4 +40,15 @@ - Foojay toolchain resolver in use (`plugins { id("org.gradle.toolchains.foojay-resolver-convention") }`). ## Current testing reality -- No committed `*Test*.kt` files; test tasks may run zero tests unless new tests are added. \ No newline at end of file +- No committed `*Test*.kt` files; test tasks may run zero tests unless new tests are added. + +## Release workflow (`.github/workflows/release.yml`) +- Triggered by `workflow_dispatch` with a `release_type` choice input (`stable` | `nightly`). +- `prepare-deps` job checks out & publishes to `mavenLocal`: + - `kdroidFilter/ComposeNativeWebview` (compose-webview) + - `team-spotube/gradle-plugin` (spotubeGradle + vlcjBundler plugins) +- Build jobs per platform (Android, Linux, Windows, macOS), all `needs: prepare-deps`. +- **Stable**: reads `versionName` from `composeApp/build.gradle.kts`, tag = `v{version}`, draft release. +- **Nightly**: builds with `-PversionName=nightly`, tag = `nightly` (updates existing), prerelease. +- **Android signing**: decodes `secrets.KEYSTORE` (base64) → `composeApp/upload-keystore.jks`, writes signing config into `local.properties` from secrets. +- `create-release` job (depends on all builds) uses `softprops/action-gh-release@v2` to create the GitHub release with all artifacts attached. \ No newline at end of file diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 5252f648..5b0e6c41 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -228,7 +228,7 @@ android { minSdk = libs.versions.android.minSdk.get().toInt() targetSdk = libs.versions.android.targetSdk.get().toInt() versionCode = 1 - versionName = "1.0" + versionName = project.findProperty("versionName") as String? ?: "1.0" } packaging { resources { @@ -289,7 +289,7 @@ compose.desktop { nativeDistributions { packageName = "dev.krtirtho.spotube" - packageVersion = "6.0.0" + packageVersion = project.findProperty("versionName") as String? ?: "6.0.0" licenseFile = project.file("../LICENSE") targetFormats(