Improve reference #703
Workflow file for this run
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: Java CI with Maven (PR) | |
on: | |
pull_request: | |
types: [opened, synchronize, ready_for_review, labeled] | |
concurrency: pr-${{ github.event.pull_request.id }} | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'release') || contains(github.event.pull_request.labels.*.name, 'maven') }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check if version is updated | |
uses: avides/[email protected] | |
id: engine_version_check | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
file-to-check: multiapi-engine/pom.xml | |
continue-on-error: true | |
- name: Check if version is updated | |
uses: avides/[email protected] | |
id: maven_plugin_version_check | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
file-to-check: scs-multiapi-maven-plugin/pom.xml | |
continue-on-error: true | |
- name: Warn about version specification | |
if: ${{ steps.engine_version_check.outcome != 'success' || steps.maven_plugin_version_check.outcome != 'success' }} | |
uses: thollander/actions-comment-pull-request@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
message: Project version has not been updated in pom.xml. Please, update your version using https://semver.org specifications | |
- name: Fail | |
if: ${{ steps.engine_version_check.outcome != 'success' || steps.maven_plugin_version_check.outcome != 'success' }} | |
uses: cutenode/action-always-fail@v1 | |
- name: New software version | |
if: ${{ steps.engine_version_check.outcome == 'success' && steps.maven_plugin_version_check.outcome == 'success' }} | |
run: echo "New multiapi engine version is " ${{ steps.engine_version_check.outputs.version }} | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: "11" | |
distribution: "adopt" | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Build Engine Plugin | |
run: | | |
cd multiapi-engine | |
mvn -B install | |
- name: Build Maven Plugin | |
# Uses production profile to sign with gpg plugin | |
run: | | |
cd scs-multiapi-maven-plugin | |
mvn -B install | |
- name: Build Gradle Plugin | |
run: | | |
cd scs-multiapi-gradle-plugin | |
gradle wrapper | |
chmod +x gradlew | |
./gradlew build | |
check-labels: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.mergeable == true | |
steps: | |
- name: Warn about missing labels | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'release') && !contains(github.event.pull_request.labels.*.name, 'documentation') && !contains(github.event.pull_request.labels.*.name, 'maven') && !contains(github.event.pull_request.labels.*.name, 'gradle')}}} | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
message: "This pull request hasn't been labeled as `release`, `gradle`, `maven` nor `documentation`. Please ensure this is intentional before merging." | |
comment_tag: label-warn |