diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 00000000..8c883573 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,58 @@ +name: "Bug Report" +description: Report a bug +title: "[BUG] - " +labels: [ + "bug" +] +body: + - type: textarea + id: description + attributes: + label: "Description" + description: Please enter a description of the bug + validations: + required: true + - type: textarea + id: reprod + attributes: + label: "Reproduction steps" + description: Please enter the steps to reproduce + value: | + 1. Click on '...' + 2. Scroll to '....' + 3. See error + validations: + required: false + - type: input + id: app-version + attributes: + label: "App Version" + description: What version of the app? + placeholder: "v0.1.0" + validations: + required: true + - type: input + id: server + attributes: + label: "Server Version" + description: What version of the server? + placeholder: "10.10.7" + validations: + required: true + - type: input + id: device + attributes: + label: "Device" + description: What device are you using? + placeholder: "NVIDIA Shield TV Pro 2019" + validations: + required: false + - type: textarea + id: logs + attributes: + label: "Logs" + description: Please gather any logs or crash reports and include them here. + placeholder: Review logs for personal information before sharing them here publicly! + render: bash + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/new-feature.yml b/.github/ISSUE_TEMPLATE/new-feature.yml new file mode 100644 index 00000000..500beea4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new-feature.yml @@ -0,0 +1,15 @@ +name: "Feature Request" +description: Request a new feature +title: "[FEA] - <title>" +labels: [ + "enhancement" +] +body: + - type: textarea + id: description + attributes: + label: "Description" + description: Please enter a description of the feature + placeholder: "I would like to see..." + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 00000000..bd10bd46 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,15 @@ +name: "Question" +description: Ask a question +title: "[QST] - <title>" +labels: [ + "question" +] +body: + - type: textarea + id: description + attributes: + label: "Question" + description: Please enter your question + placeholder: "How do I...?" + validations: + required: true diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..0f2b2c9e --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,23 @@ +changelog: + exclude: + labels: [] + authors: [] + categories: + - title: Breaking Changes + labels: + - breaking change + - title: New Features & Enhancements + labels: + - enhancement + - title: UI/UX Improvements + labels: + - user interface + exclude: + labels: + - bug + - title: Bug Fixes + labels: + - bug + - title: Other changes + labels: + - "*" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..19ecfe82 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,128 @@ +name: Development build + +on: + push: + branches: + - main + - develop/* + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + APK_SHORT_NAME: Wholphin-release.apk + APK_DEBUG_SHORT_NAME: Wholphin-debug.apk + BRANCH_NAME: ${{ github.ref_name }} + BUILD_TOOLS_VERSION: 36.0.0 + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout the code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Need the tags to build + # Setup the SDKs + - name: Setup JDK + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: '21' + cache: 'gradle' + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + with: + packages: "tools platform-tools build-tools;${{ env.BUILD_TOOLS_VERSION }}" + + - name: Get version names + run: | + LATEST_TAG=$(git describe --tags --match 'v*' --abbrev=0) + VERSION_NAME=$(git describe --tags --match 'v*' --long) + if [[ $BRANCH_NAME == "main" ]]; then + TAG_NAME="develop" + else + TAG_NAME="${BRANCH_NAME/\//-}" + fi + + echo "LATEST_TAG=$LATEST_TAG" >> "$GITHUB_ENV" + echo "VERSION_NAME=$VERSION_NAME" >> "$GITHUB_ENV" + echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" + - name: Build release app + id: build + env: + KEY_ALIAS: "${{ secrets.KEY_ALIAS }}" + KEY_PASSWORD: "${{ secrets.KEY_PASSWORD }}" + KEY_STORE_PASSWORD: "${{ secrets.KEY_STORE_PASSWORD }}" + SIGNING_KEY: "${{ secrets.SIGNING_KEY }}" + run: | + ./gradlew clean assembleRelease assembleDebug + echo "apk=$(ls app/build/outputs/apk/release/Wholphin-release*.apk)" >> "$GITHUB_OUTPUT" + echo "apk_debug=$(ls app/build/outputs/apk/debug/Wholphin-debug*.apk)" >> "$GITHUB_OUTPUT" + - name: Verify signature + run: | + echo "Verify release APK" + ${{env.ANDROID_SDK_ROOT}}/build-tools/${{ env.BUILD_TOOLS_VERSION }}/apksigner verify --verbose --print-certs "${{ steps.build.outputs.apk }}" + echo "Verify debug APK" + ${{env.ANDROID_SDK_ROOT}}/build-tools/${{ env.BUILD_TOOLS_VERSION }}/apksigner verify --verbose --print-certs "${{ steps.build.outputs.apk_debug }}" + - name: Copy APK to ${{ env.APK_SHORT_NAME }} + run: | + cp "${{ steps.build.outputs.apk }}" "${{ env.APK_SHORT_NAME }}" + cp "${{ steps.build.outputs.apk_debug }}" "${{ env.APK_DEBUG_SHORT_NAME }}" + - name: Checksums + run: | + echo "SHA256 checksums:" + sha256sum "${{ steps.build.outputs.apk }}" "${{ env.APK_SHORT_NAME }}" + sha256sum "${{ steps.build.outputs.apk_debug }}" "${{ env.APK_DEBUG_SHORT_NAME }}" + - name: Delete ${{ env.TAG_NAME }} tag and release + uses: dev-drprasad/delete-tag-and-release@v1.1 + with: + tag_name: "${{ env.TAG_NAME }}" + delete_release: true + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Advance ${{ env.TAG_NAME }} tag + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + await github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: "refs/tags/${{ env.TAG_NAME }}", + sha: context.sha + }) + + - name: Create GitHub release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifactErrorsFailBuild: true + artifacts: "${{ steps.build.outputs.apk_debug }},${{ steps.build.outputs.apk }},${{ env.APK_DEBUG_SHORT_NAME }},${{ env.APK_SHORT_NAME }}" + draft: false + generateReleaseNotes: false + makeLatest: false + name: "${{ env.VERSION_NAME }}" + prerelease: true + removeArtifacts: true + replacesArtifacts: true + updateOnlyUnreleased: true + tag: "${{ env.TAG_NAME }}" + + body: | + ### `${{ env.BRANCH_NAME }}` development build + + This pre-release tracks the development debug build of Wholphin from the `${{ env.BRANCH_NAME }}` branch. + + See https://github.com/damontecres/Wholphin/releases/latest for the latest stable release. + + If you want to update to this version in-app, change Settings->Advanced->Update URL to https://api.github.com/repos/damontecres/Wholphin/releases/tags/${{ env.TAG_NAME }} (replace `latest` with `tags/${{ env.TAG_NAME }}`). + + [See changes since `${{ env.LATEST_TAG }}`](https://github.com/damontecres/Wholphin/compare/${{ env.LATEST_TAG }}...${{ env.TAG_NAME }}) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..afba33bd --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,65 @@ +name: PR + +on: + pull_request: + +defaults: + run: + shell: bash + +env: + BUILD_TOOLS_VERSION: 36.0.0 + BUILD_DIRS_ARTIFACT: build-dirs + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Need the tags to build + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 + + build: + runs-on: ubuntu-latest + needs: pre-commit + steps: + - name: Checkout the code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Need the tags to build + - name: Setup JDK + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: '21' + cache: 'gradle' + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + with: + packages: "tools platform-tools build-tools;${{ env.BUILD_TOOLS_VERSION }}" + - name: Build app + id: buildapp + run: | + ./gradlew clean build + echo "apk=$(ls app/build/outputs/apk/debug/Wholphin-debug*.apk)" >> "$GITHUB_OUTPUT" + - name: Tar build dirs + run: | + tar -czf build.tgz */build/. + - uses: actions/upload-artifact@v4 + id: upload-build-dirs + with: + name: "${{ env.BUILD_DIRS_ARTIFACT }}" + path: build.tgz + if-no-files-found: error + - uses: actions/upload-artifact@v4 + with: + name: Wholphin-debug.apk + path: "${{ steps.buildapp.outputs.apk }}" + compression-level: 0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..c3b856c9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +name: Create release + +on: + push: + tags: + - v* + +defaults: + run: + shell: bash + +env: + APK_SHORT_NAME: Wholphin.apk + BUILD_TOOLS_VERSION: 36.0.0 + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout the code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Need the tags to build + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Setup JDK + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: '21' + cache: 'gradle' + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + with: + packages: "tools platform-tools build-tools;${{ env.BUILD_TOOLS_VERSION }}" + - name: Build app + id: buildapp + env: + KEY_ALIAS: "${{ secrets.KEY_ALIAS }}" + KEY_PASSWORD: "${{ secrets.KEY_PASSWORD }}" + KEY_STORE_PASSWORD: "${{ secrets.KEY_STORE_PASSWORD }}" + SIGNING_KEY: "${{ secrets.SIGNING_KEY }}" + run: | + ./gradlew clean assembleRelease + echo "apk=$(ls app/build/outputs/apk/release/Wholphin-release*.apk)" >> "$GITHUB_OUTPUT" + - name: Verify signature + run: | + ${{env.ANDROID_SDK_ROOT}}/build-tools/${{ env.BUILD_TOOLS_VERSION }}/apksigner verify --verbose --print-certs "${{ steps.buildapp.outputs.apk }}" + - name: Copy APK to ${{ env.APK_SHORT_NAME }} + run: | + cp "${{ steps.buildapp.outputs.apk }}" "${{ env.APK_SHORT_NAME }}" + - name: Checksums + run: | + echo "SHA256 checksums:" + sha256sum "${{ steps.buildapp.outputs.apk }}" "${{ env.APK_SHORT_NAME }}" + - name: Create GitHub release + uses: ncipollo/release-action@v1 + with: + artifacts: "${{ steps.buildapp.outputs.apk }},${{ env.APK_SHORT_NAME }}" + makeLatest: true + prerelease: false + generateReleaseNotes: true