Skip to content

Commit

Permalink
AND-6762 Publishing BLST library
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoggam1 authored and kozarezvlad committed Apr 19, 2024
1 parent 6ea4af7 commit 1520bad
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/neutral-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Neutral Build

on:
push:
branches:
- 'release/**'
- 'release-app_[0-9]+.[0-9]+'
- 'develop'
- 'master'
workflow_dispatch:

env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DVELOPMENT_ANDROID }}

jobs:
tag:
name: Create tag
runs-on: ubuntu-latest
steps:
- name: Setup swig
uses: mmomtchev/setup-swig@v1

- name: Verify
run: swig -version
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'

- name: Install Android Dependencies
run: |
tools/install-android-dependencies
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Create tag
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}",
sha: context.sha
})
- name: Build and publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
run: |
echo sdk.dir = $ANDROID_HOME > local.properties
./gradlew -PgithubUser=${{ secrets.GITHUB_ACTOR }} -PgithubPass=${{ secrets.GITHUB_TOKEN }} -PartifactVersion=${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }} publish
- name: Build notification
if: always()
uses: adamkdean/simple-slack-notify@master
with:
channel: '#development-android'
status: ${{ job.status }}
success_text: 'Blockchain SDK build (${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}) has been created and uploaded to Nexus.'
failure_text: 'GitHub Action #${{ github.run_number }} failed. Tag has not been not created.'
cancelled_text: 'GitHub Action #${{ github.run_number }} was cancelled'
fields: |
[{"title": "TAG", "value": "${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}"},
{"title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}]
26 changes: 26 additions & 0 deletions tools/android-sdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

find_android_cmdline_tools() {
# Default version of cmdline tools is 11.
# https://github.com/android-actions/setup-android/blob/9584f05408b63719e3464df8ac85bdbe58f88a64/src/main.ts#L9
CMDLINE_TOOLS_VERSION="11.0"

if [[ "$ANDROID_HOME" == "" ]]; then
>&2 echo "ANDROID_HOME is not set. Use a default path"
ANDROID_HOME="$HOME/Library/Android/sdk"
fi

# cmdline-tools could have a 'latest' version, but if it was installed 2 years ago it may not be 'latest' as of today
if [ -x "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" ]; then
echo "$ANDROID_HOME/cmdline-tools/latest/bin"
return 0
fi

if [ -x "$ANDROID_HOME/cmdline-tools/$CMDLINE_TOOLS_VERSION/bin/sdkmanager" ]; then
echo "$ANDROID_HOME/cmdline-tools/$CMDLINE_TOOLS_VERSION/bin"
return 0
fi

>&2 echo "ERROR: cannot find SDK cmdline tools within '$ANDROID_HOME'"
exit 22
}
11 changes: 11 additions & 0 deletions tools/install-android-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e

source "$(dirname $0)/android-sdk"

ANDROID_CMDTOOLS=$(find_android_cmdline_tools)

$ANDROID_CMDTOOLS/sdkmanager --verbose "ndk;24.0.8215888"

echo -e "y\ny\ny\ny\ny\n" | $ANDROID_CMDTOOLS/sdkmanager --licenses

0 comments on commit 1520bad

Please sign in to comment.