CI change 2 #2
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
name: Neutral Build | |
on: | |
push: | |
branches: | |
- 'tangem-master' | |
workflow_dispatch: | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DVELOPMENT_ANDROID }} | |
jobs: | |
tag: | |
name: Create tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: vico | |
- name: set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: zulu | |
- uses: gradle/gradle-build-action@v3 | |
- run: | | |
cd ${{ github.workspace }}/vico | |
VERSION_NAME=$(grep -oP "(?<=version_name).*(?=\",)" versions.gradle | grep -oP "(?<=\").*") | |
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV | |
echo "TAG_NAME=v$VERSION_NAME" >> $GITHUB_ENV | |
./gradlew assembleDebug | |
- 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/${{ env.VERSION_NAME }}", | |
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=${{ env.VERSION_NAME }} publish | |
- name: Build notification | |
if: always() | |
uses: adamkdean/simple-slack-notify@master | |
with: | |
channel: '#development-android' | |
status: ${{ job.status }} | |
success_text: 'Tangem Vico library build (${{ env.VERSION_NAME }}) 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": "${{ env.VERSION_NAME }}"}, | |
{"title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}] |