Skip to content

Neutral Build

Neutral Build #10

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-20.04
steps:
- name: Setup swig
uses: mmomtchev/setup-swig@v1
- name: Verify
run: swig -version
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
version: v4.2.1
- 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
GITHUB_USER=${{ secrets.GITHUB_ACTOR }} GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} ./gradlew build assembleRelease publish -Pversion=${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}
- 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}"}]