Merge pull request #109 from Voinea-Radu/renovate/org.jetbrains-annot… #240
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: Build | |
on: | |
push: | |
branches: | |
- master | |
- main | |
workflow_run: | |
workflows: [ "Patch Version" ] | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: write | |
steps: | |
# ==================== SETUPS ==================== | |
- name: Checkout Codebase | |
uses: actions/checkout@v4 | |
with: | |
node-version: '12.x' | |
- name: Setup Python | |
uses: actions/setup-python@v5.2.0 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 21 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
build-scan-publish: true | |
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" | |
build-scan-terms-of-use-agree: "yes" | |
# ==================== INCREMENT VERSION ===================== | |
- name: Increment Version | |
run: | | |
python3 scripts/increment_version.py | |
# ==================== PUBLISH ==================== | |
- name: Commit to Repository | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Incremented patch version | |
commit_options: '--no-verify --signoff' | |
commit_user_name: Voinea Radu | |
commit_user_email: contact@voinearadu.com | |
# ==================== BUILD ==================== | |
- name: Export Credentials | |
run: | | |
mkdir -p ~/.gradle | |
echo " | |
com.voinearadu.url=https://repository.voinearadu.com/repository/maven-releases/ | |
com.voinearadu.auth.username=admin | |
com.voinearadu.auth.password=${{ secrets.NEXUS_PASSWORD }} | |
" > ~/.gradle/gradle.properties | |
if [ "${{ secrets.NEXUS_PASSWORD }}" == "" ]; then echo "com.voinearadu.publish=false" >> ~/.gradle/gradle.properties; fi | |
- name: Cache Gradle Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle | |
restore-keys: | | |
${{ runner.os }}-gradle | |
- name: Set gradle permissions | |
run: chmod +x gradlew | |
- name: Execute Gradle Build | |
run: ./gradlew build | |
# ==================== ENVIRONMENT VARIABLES ==================== | |
- name: External scripts - Environment Variables | |
run: | | |
echo "VERSION=$(./gradlew properties -q | grep "^version:" | awk '{print $2}')" >> $GITHUB_ENV | |
echo "ARTIFACT=$(./gradlew properties -q | grep "^name:" | awk '{print $2}')" >> $GITHUB_ENV | |
echo "GROUP=$(./gradlew properties -q | grep "^group:" | awk '{print $2}')" >> $GITHUB_ENV | |
echo "REPOSITORY_NAME=$(echo $REPOSITORY_NAME | awk -F'/' '{print $2}')" >> $GITHUB_ENV | |
# ==================== PUBLISH ==================== | |
- name: Execute Gradle Publish | |
run: ./gradlew publish | |
- name: Automatic Releases | |
uses: marvinpinto/action-automatic-releases@v1.2.1 | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "${{ env.VERSION }}" | |
prerelease: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' }} | |
title: "${{ env.VERSION }}" | |
files: | | |
build/libs/*.jar | |
src/*/build/libs/*.jar | |
src/*/*/build/libs/*.jar | |
src/*/*/*/build/libs/*.jar |