Skip to content

309 fail to execute a file (#310) #80

309 fail to execute a file (#310)

309 fail to execute a file (#310) #80

name: Java CI with Gradle (Push)
on:
push:
branches: [main]
jobs:
check-pr-labels:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
labels: ${{ steps.get-pr.outputs.pr_labels }}
steps:
- name: Get Pull Request information
uses: 8BitJonny/[email protected]
id: get-pr
check-version:
runs-on: ubuntu-latest
needs: [check-pr-labels]
if: ${{ contains(needs.check-pr-labels.outputs.labels, 'release') || contains(needs.check-pr-labels.outputs.labels, 'gradle') }}
steps:
- uses: actions/checkout@v3
- name: Check if engine 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: Gradle version
id: get-version
run: |
cd scs-multiapi-gradle-plugin
echo "version=$(gradle properties -q | grep "version:" | awk '{print $2}')" | tee $GITHUB_OUTPUT
- name: Check if plugin version has been published
uses: lakuapik/gh-actions-http-status@v1
id: plugin-version-check
with:
sites: '["https://plugins.gradle.org/plugin/com.sngular.scs-multiapi-gradle-plugin/${{ steps.get-version.outputs.version }}"]'
expected: '[400]'
build:
runs-on: ubuntu-latest
needs: [check-version, check-pr-labels]
if: contains(needs.check-version.result, 'success')
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- 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: Publish Gradle plugin to Gradle Repo
run: |
cd scs-multiapi-gradle-plugin
gradle wrapper
chmod +x gradlew
./gradlew build
./gradlew publishPlugins -Dgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Dgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }}
- name: Gradle version
uses: thecodemonkey/action-get-gradle-version@master
id: get-version
with:
file: scs-multiapi-gradle-plugin/build.gradle
- name: Create a Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: ${{ steps.get-version.outputs.version }}
prerelease: false
title: "Gradle Release ${{ steps.get-version.outputs.version }}"