Build n Release Asustor Ookla Speedtest Package #12
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 n Release Asustor Ookla Speedtest Package | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build-apk: | |
| name: Build Package | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # required for softprops/action-gh-release | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get release tag | |
| id: get_latest_tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "new_tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT | |
| else | |
| # Get most recent release including pre-releases | |
| latest_tag=$(curl -s "https://api.github.com/repos/007revad/Asustor_Ookla_Speedtest/releases?per_page=1" \ | |
| | jq -r '.[0].tag_name // empty') | |
| if [ -z "$latest_tag" ]; then | |
| echo "ERROR: Could not determine release tag" >&2 | |
| exit 1 | |
| fi | |
| echo "new_tag=$latest_tag" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Update version in config.json | |
| run: | | |
| tag="${{ steps.get_latest_tag.outputs.new_tag }}" | |
| # Strip leading 'v' if present (config.json version should be e.g. 1.0.0 not v1.0.0) | |
| version="${tag#v}" | |
| jq --arg v "$version" '.general.version = $v' src/CONTROL/config.json > tmp.json | |
| mv tmp.json src/CONTROL/config.json | |
| - name: Check if APKs already exist in release | |
| id: check_assets | |
| run: | | |
| existing=$(curl -s "https://api.github.com/repos/007revad/Asustor_Ookla_Speedtest/releases/tags/${{ steps.get_latest_tag.outputs.new_tag }}" \ | |
| | jq -r '.assets[].name' | grep -c '\.apk' || true) | |
| echo "apk_count=$existing" >> $GITHUB_OUTPUT | |
| - name: Package Asustor App | |
| id: package_asustor_app | |
| uses: asustor-contrib/ga-package-asustor-app@v2 | |
| with: | |
| apkg-dir: 'src' | |
| out-dir: 'dist' | |
| - name: Upload Package artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Ookla-speedtest-${{ steps.get_latest_tag.outputs.new_tag }} | |
| path: dist/*.apk | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.get_latest_tag.outputs.new_tag }} | |
| make_latest: false | |
| files: dist/*.apk |