|
| 1 | +name: Pre-release Channel |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + target_branch: |
| 7 | + description: Branch to build from |
| 8 | + required: true |
| 9 | + tag_name: |
| 10 | + description: Pre-release tag (example XtreamPlayerv3.3.6-rc1) |
| 11 | + required: true |
| 12 | + release_title: |
| 13 | + description: Release title (example Xtream Player v3.3.6-rc1) |
| 14 | + required: true |
| 15 | + release_notes: |
| 16 | + description: Release notes (must start with # Changes:) |
| 17 | + required: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + publish-pre-release: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + permissions: |
| 23 | + contents: write |
| 24 | + steps: |
| 25 | + - name: Checkout target branch |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + ref: ${{ inputs.target_branch }} |
| 29 | + |
| 30 | + - name: Set up JDK 17 |
| 31 | + uses: actions/setup-java@v4 |
| 32 | + with: |
| 33 | + distribution: temurin |
| 34 | + java-version: "17" |
| 35 | + cache: gradle |
| 36 | + |
| 37 | + - name: Validate Metadata |
| 38 | + run: | |
| 39 | + set -euo pipefail |
| 40 | + notes_file="$(mktemp)" |
| 41 | + printf '%s\n' "${{ inputs.release_notes }}" > "${notes_file}" |
| 42 | + ./scripts/validate_release_metadata.sh \ |
| 43 | + "${{ inputs.tag_name }}" \ |
| 44 | + "${{ inputs.release_title }}" \ |
| 45 | + "${notes_file}" \ |
| 46 | + "true" \ |
| 47 | + "${{ inputs.target_branch }}" |
| 48 | +
|
| 49 | + - name: Build Release APK |
| 50 | + run: | |
| 51 | + set -euo pipefail |
| 52 | + ./gradlew :app:assembleRelease --stacktrace |
| 53 | +
|
| 54 | + - name: Resolve APK Path |
| 55 | + id: apk |
| 56 | + run: | |
| 57 | + set -euo pipefail |
| 58 | + apk_path="$(ls -1 app/build/outputs/apk/release/*.apk | head -n 1)" |
| 59 | + if [[ -z "${apk_path}" ]]; then |
| 60 | + echo "No APK found." |
| 61 | + exit 1 |
| 62 | + fi |
| 63 | + echo "apk_path=${apk_path}" >> "${GITHUB_OUTPUT}" |
| 64 | +
|
| 65 | + - name: Publish Pre-release |
| 66 | + uses: softprops/action-gh-release@v2 |
| 67 | + with: |
| 68 | + tag_name: ${{ inputs.tag_name }} |
| 69 | + target_commitish: ${{ inputs.target_branch }} |
| 70 | + name: ${{ inputs.release_title }} |
| 71 | + body: ${{ inputs.release_notes }} |
| 72 | + prerelease: true |
| 73 | + files: ${{ steps.apk.outputs.apk_path }} |
0 commit comments