Merge remote-tracking branch 'origin/develop' into develop #162
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 and publish | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
build: | |
name: Build LEGUI | |
runs-on: ubuntu-latest | |
steps: | |
# CHECKOUT | |
- uses: actions/checkout@v3 | |
# EVALUATE VARIABLES | |
- name: Get Version Property | |
id: read_property | |
uses: christian-draeger/[email protected] | |
with: | |
path: ./gradle.properties | |
property: version | |
- name: Set environment variables | |
run: | | |
echo "branch=develop" >> $GITHUB_ENV | |
echo "publishUrl=git:releases://[email protected]:SpinyOwl/repo.git" >> $GITHUB_ENV | |
echo "version=${{steps.read_property.outputs.value}}" >> $GITHUB_ENV | |
echo "repoUrl=https://github.com/SpinyOwl/repo/tree/releases/com/spinyowl/legui" >> $GITHUB_ENV | |
# CALL WEBHOOK | |
- name: Send message build started | |
uses: rjstone/discord-webhook-notify@v1 | |
with: | |
severity: info | |
color: '#808080' | |
description: Build started | |
footer: "https://github.com/SpinyOwl/legui" | |
webhookUrl: ${{ secrets.WEBHOOK_URL }} | |
# PREPARE AND BUILD | |
- name: Set up JDK | |
uses: actions/[email protected] | |
with: | |
java-version: 16 | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Build with Gradle | |
run: ./gradlew build | |
# RUN TESTS | |
- name: Run tests | |
run: ./gradlew test | |
# SONAR CHECK | |
- name: Run sonarqube check | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
sonarLogin: ${{secrets.sonarToken}} | |
JAVA_OPTS: -Xmx3072m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=128m | |
GRADLE_OPTS: -Xmx3800m -XX:ReservedCodeCacheSize=128m -Dorg.gradle.daemon=false | |
run: ./gradlew sonarqube | |
# PUBLISH ARTIFACTS | |
- name: Build artifacts | |
run: ./gradlew publish | |
- name: Publish Artifact to GIT | |
uses: SpinyOwl/[email protected] | |
if: "!contains(github.event.head_commit.message, '[skip publish]')" | |
with: | |
repository: SpinyOwl/repo | |
branch: releases | |
github_token: '${{ secrets.GITHUB_TOKEN }}' | |
github_pat: '${{ secrets.GH_PAT }}' | |
source_folder: build/publish | |
no_delete: true | |
# CALL WEBHOOK | |
- name: Send message build finished | |
uses: rjstone/discord-webhook-notify@v1 | |
if: success() && !contains(github.event.head_commit.message, '[skip publish]') | |
with: | |
severity: info | |
details: | | |
Build successfully finished. | |
**Artifact version** - `${{env.version}}`. | |
Browse artifacts: [Browse artifacts](${{env.repoUrl}}/${{env.version}}) | |
footer: "https://github.com/SpinyOwl/legui" | |
webhookUrl: ${{ secrets.WEBHOOK_URL }} | |
- name: Send message build finished | |
uses: rjstone/discord-webhook-notify@v1 | |
if: success() && contains(github.event.head_commit.message, '[skip publish]') | |
with: | |
severity: info | |
details: | | |
Build successfully finished. | |
Browse artifacts: [Browse artifacts](${{env.repoUrl}}) | |
footer: "https://github.com/SpinyOwl/legui" | |
webhookUrl: ${{ secrets.WEBHOOK_URL }} | |
- name: Send message build failed | |
uses: rjstone/discord-webhook-notify@v1 | |
if: failure() | |
with: | |
severity: error | |
details: | | |
Build failed. | |
Browse artifacts: [Browse artifacts](${{env.repoUrl}}) | |
footer: "https://github.com/SpinyOwl/legui" | |
webhookUrl: ${{ secrets.WEBHOOK_URL }} | |
- name: Send message build cancelled | |
uses: rjstone/discord-webhook-notify@v1 | |
if: cancelled() | |
with: | |
severity: warn | |
details: | | |
Build cancelled. | |
Browse artifacts: [Browse artifacts](${{env.repoUrl}}) | |
footer: "https://github.com/SpinyOwl/legui" | |
webhookUrl: ${{ secrets.WEBHOOK_URL }} |