Fixed publishing #6
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/[email protected] | |
- 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: [email protected] | |
# ==================== BUILD ==================== | |
- name: Export Credentials | |
run: | | |
mkdir -p ~/.gradle | |
echo " | |
voinearadu.url=https://repository.voinearadu.com/repository/maven-releases/ | |
voinearadu.auth.username=admin | |
voinearadu.auth.password=${{ secrets.NEXUS_PASSWORD }} | |
" > ~/.gradle/gradle.properties | |
- 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/[email protected] | |
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 |