-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ea4af7
commit 1520bad
Showing
3 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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}"}] |
This file contains 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
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 | ||
} |
This file contains 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
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 |