Skip to content

Commit

Permalink
Add action to build APK using latest Kolibri release.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Jan 18, 2024
1 parent daf7ef8 commit da79e13
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 4 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/build_apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ on:
workflow_call:
inputs:
tar-file-name:
required: true
required: false
type: string
tar-url:
required: false
type: string
ref:
description: 'A ref for this workflow to check out its own repo'
required: true
required: false
type: string
signed:
description: 'Should this be signed with the development key? (mutually exclusive with release)'
Expand Down Expand Up @@ -76,11 +79,16 @@ jobs:
apk-file-name: ${{ steps.get-apk-filename.outputs.apk-file-name }}
version-code: ${{ steps.get-version-code.outputs.version-code}}
steps:
- name: Validate inputs
- name: Validate release flag inputs
if: ${{ (inputs.release == true || github.event.inputs.release == 'true') && (inputs.signed == true || github.event.inputs.signed == 'true') }}
run: |
echo "Cannot build a release and signed development APK at the same time."
exit 1
- name: Validate tar reference inputs
if: ${{ !github.event.inputs.tar-file-name && ( (inputs.tar-file-name && inputs.tar-url) || (!inputs.tar-file-name && !inputs.tar-url) ) }}
run: |
echo "Must specify only one reference for the tar file to build the APK with."
exit 1
- uses: actions/checkout@v4
if: ${{ !inputs.ref }}
- uses: actions/checkout@v4
Expand Down Expand Up @@ -132,9 +140,12 @@ jobs:
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Download the tarfile from URL
- name: Download the tarfile from URL for workflow_dispatch
if: ${{ github.event.inputs.tar-url }}
run: make get-tar tar=${{ github.event.inputs.tar-url }}
- name: Download the tarfile from URL for workflow_call
if: ${{ inputs.tar-url }}
run: make get-tar tar=${{ inputs.tar-url }}
- name: Download the tarfile from artifacts
if: ${{ inputs.tar-file-name }}
uses: actions/download-artifact@v4
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build APK for PRs

on:
pull_request:
branches:
- develop

jobs:
pre_job:
name: Path match check
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
github_token: ${{ github.token }}
paths_ignore: '["**.po", "**.json"]'
latest_kolibri_release:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
outputs:
tar-url: ${{ steps.get_latest_kolibri_release.outputs.result }}}
steps:
- name: Get latest Kolibri release
id: get_latest_kolibri_release
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { data: releases } = await github.rest.repos.listReleases({
owner: 'learningequality',
repo: 'kolibri',
per_page: 1,
page: 1,
});
const latestRelease = releases[0];
const tarAsset = latestRelease.assets.find(asset => asset.name.endsWith('.tar.gz'));
const tarUrl = tarAsset.browser_download_url;
return tarUrl;
build_apk:
name: Build Debug APK
needs: [pre_job, latest_kolibri_release]
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/build_apk.yml
with:
tar-url: ${{ needs.latest_kolibri_release.outputs.tar-url }}

0 comments on commit da79e13

Please sign in to comment.