-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pr/plugins 4430 fixed groovy version compatibility issues (#8)
* Added support for Groovy 3 version and Added github workflows for CI & CD and Modified readme file * Plugin version is now version id plus short hash
- Loading branch information
Showing
21 changed files
with
202 additions
and
44 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Gradle CD | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
|
||
create-release: | ||
|
||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt-openj9' | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
- name: Determine plugin version | ||
id: getPluginVersion | ||
run: | | ||
# Get version from plugin.xml | ||
pluginXmlVersion=$(grep -oP '<identifier .* version="\K[^"]+' src/main/zip/plugin.xml) | ||
echo "pluginXmlVersion is $pluginXmlVersion" | ||
# Get the latest short hash | ||
latestShortHash=$(git rev-parse --short $GITHUB_SHA) | ||
echo "latest short hash is $latestShortHash" | ||
echo "value=$pluginXmlVersion.$latestShortHash" >> $GITHUB_OUTPUT | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
|
||
- name: Create plugin zip | ||
run: ./gradlew "-PpluginVersion=${{ steps.getPluginVersion.outputs.value }}" | ||
|
||
- name: Create GitHub release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ steps.getPluginVersion.outputs.value }} | ||
files: "build/distributions/*.zip" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build Gradle Project | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-gradle-project: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt-openj9' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
|
||
- name: Run build | ||
run: ./gradlew build | ||
|
||
- name: Run tests | ||
run: ./gradlew test |
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
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
69 changes: 69 additions & 0 deletions
69
src/main/groovy/com/urbancode/air/plugin/tool/AirPluginTool.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* © Copyright IBM Corporation 2016, 2024. | ||
* This is licensed under the following license. | ||
* The Eclipse Public 1.0 License (http://www.eclipse.org/legal/epl-v10.html) | ||
* U.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. | ||
*/ | ||
package com.urbancode.air.plugin.tool | ||
|
||
class AirPluginTool { | ||
|
||
//************************************************************************** | ||
// CLASS | ||
//************************************************************************** | ||
//************************************************************************** | ||
// INSTANCE | ||
//************************************************************************** | ||
final public def isWindows = (System.getProperty('os.name') =~ /(?i)windows/).find() | ||
def out = System.out; | ||
def err = System.err; | ||
private def inPropsFile; | ||
private def outPropsFile; | ||
def outProps; | ||
public AirPluginTool(def inFile, def outFile){ | ||
inPropsFile = inFile; | ||
outPropsFile = outFile; | ||
outProps = new Properties(); | ||
} | ||
public Properties getStepProperties() { | ||
def props = new Properties(); | ||
def inputPropsFile = this.inPropsFile; | ||
def inputPropsStream = null; | ||
try { | ||
inputPropsStream = new FileInputStream(inputPropsFile); | ||
props.load(inputPropsStream); | ||
} | ||
catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
finally { | ||
inputPropsStream.close(); | ||
} | ||
return props; | ||
} | ||
public void setOutputProperty(String name, String value) { | ||
this.outProps.setProperty(name, value); | ||
} | ||
public void setOutputProperties() { | ||
OutputStream outputPropsStream = null; | ||
try { | ||
outputPropsStream = new FileOutputStream(this.outPropsFile); | ||
outProps.store(outputPropsStream, ""); | ||
} | ||
finally { | ||
if (outputPropsStream != null) { | ||
outputPropsStream.close(); | ||
} | ||
} | ||
} | ||
public String getAuthToken() { | ||
String authToken = System.getenv("AUTH_TOKEN"); | ||
return "{\"token\" : \"" + authToken + "\"}"; | ||
} | ||
public String getAuthTokenUsername() { | ||
return "PasswordIsAuthToken"; | ||
} | ||
public void storeOutputProperties() { | ||
setOutputProperties(); | ||
} | ||
} |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.