Skip to content

Commit a7c5b57

Browse files
committed
feat: No functional changes
feat: Update dependencies feat: Update build & release process feat: Releases are now automatically published to GitHub Releases page
1 parent 17d044c commit a7c5b57

File tree

9 files changed

+159
-122
lines changed

9 files changed

+159
-122
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
on:
2+
push:
3+
branches:
4+
- '**'
5+
6+
env:
7+
DIST_DIR: ${{ github.workspace }}/build/dist
8+
9+
name: Build development release
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check-out source code
15+
uses: actions/checkout@v2
16+
17+
- name: Define development release info
18+
if: startsWith(github.ref, 'refs/heads/')
19+
run: |
20+
branch="${GITHUB_REF#refs/heads/}"
21+
tag="dev_${branch//[^a-zA-Z0-9_.-]/.}" # Replace all special characters by a dot
22+
echo DO_BUILD=true >> $GITHUB_ENV # We always want to do a build if we're building a branch
23+
echo BRANCH=${branch} >> $GITHUB_ENV
24+
echo RELEASE_TAG=${tag} >> $GITHUB_ENV
25+
26+
if git ls-remote --exit-code origin refs/tags/${tag} >/dev/null 2>&1; then
27+
echo "Found tag ${tag}, development release will be published"
28+
echo DO_RELEASE=true >> $GITHUB_ENV
29+
else
30+
echo "Tag ${tag} does not exist, no development release will be published"
31+
fi
32+
33+
- name: Build development release
34+
if: env.DO_BUILD
35+
run: ./gradlew dist distThirdParty
36+
37+
- name: Publish build artifacts
38+
if: env.DO_BUILD
39+
uses: actions/upload-artifact@v2
40+
with:
41+
name: build_artifacts
42+
path: ${{ env.DIST_DIR }}
43+
44+
- name: Update development release tag
45+
uses: richardsimko/update-tag@v1
46+
if: env.DO_RELEASE
47+
with:
48+
tag_name: ${{ env.RELEASE_TAG }}
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Create pre-release
53+
if: env.DO_RELEASE
54+
run: |
55+
files=$(find "${{ env.DIST_DIR }}" -type f -printf "%p ")
56+
gh release delete ${{ env.RELEASE_TAG }} -y || true
57+
gh release create ${{ env.RELEASE_TAG }} -p -t "Development Release - ${{ env.BRANCH }} branch" -n 'See `Assets` section below for latest build artifacts' ${files}
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
62+
63+
64+
65+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
env:
7+
DIST_DIR: ${{ github.workspace }}/build/dist
8+
9+
name: Build production release
10+
jobs:
11+
build-and-release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check-out source code
15+
uses: actions/checkout@v2
16+
17+
- name: Generate and process release PR
18+
id: release_please
19+
uses: GoogleCloudPlatform/release-please-action@v2
20+
with:
21+
release-type: simple
22+
package-name: ${{ github.event.repository.name }}
23+
24+
- name: Define production release info
25+
if: steps.release_please.outputs.release_created
26+
run: |
27+
tag=${{steps.release_please.outputs.tag_name}}
28+
version=${{steps.release_please.outputs.version}}
29+
major=${{steps.release_please.outputs.major}}
30+
minor=${{steps.release_please.outputs.minor}}
31+
patch=${{steps.release_please.outputs.patch}}
32+
echo DO_RELEASE=true >> $GITHUB_ENV
33+
echo RELEASE_TAG=${tag} >> $GITHUB_ENV
34+
echo RELEASE_VERSION=${version} >> $GITHUB_ENV
35+
36+
- name: Build production release
37+
if: env.DO_RELEASE
38+
run: ./gradlew dist distThirdParty -Pversion=${{env.RELEASE_VERSION}}
39+
40+
- name: Upload assets to release
41+
if: env.DO_RELEASE
42+
run: |
43+
tag=${{ steps.release_please.outputs.tag_name }}
44+
files=$(find "${{ env.DIST_DIR }}" -type f -printf "%p ")
45+
gh release upload "${tag}" $files --clobber
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+

.travis.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

README.md

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ This Fortify SSC parser plugin allows for importing scan results from OWASP Depe
3030

3131
### Related Links
3232

33-
* **Downloads**:
34-
_Beta versions may be unstable or non-functional. The `*-thirdparty.zip` file is for informational purposes only and does not need to be downloaded._
35-
* **Release versions**: https://bintray.com/package/files/fortify-ps/release/fortify-ssc-parser-owasp-dependency-check?order=desc&sort=fileLastModified&basePath=&tab=files
36-
* **Beta versions**: https://bintray.com/package/files/fortify-ps/beta/fortify-ssc-parser-owasp-dependency-check?order=desc&sort=fileLastModified&basePath=&tab=files
37-
* **Sample input files**: [sampleData](sampleData)
33+
* **Downloads**: https://github.com/fortify-ps/fortify-ssc-parser-owasp-dependency-check/releases
34+
* _Development releases may be unstable or non-functional. The `*-thirdparty.zip` file is for informational purposes only and does not need to be downloaded._
35+
* **Sample input files**: [sampleData](sampleData)
3836
* **GitHub**: https://github.com/fortify-ps/fortify-ssc-parser-owasp-dependency-check
39-
* **Automated builds**: https://travis-ci.com/fortify-ps/fortify-ssc-parser-owasp-dependency-check
37+
* **Automated builds**: https://github.com/fortify-ps/fortify-ssc-parser-owasp-dependency-check/actions
4038
* **OWASP Dependency Check website**: https://owasp.org/www-project-dependency-check/
4139

4240

@@ -98,8 +96,7 @@ SSC clients (FortifyClient, Maven plugin, ...):
9896

9997
## Developers
10098

101-
The following sections provide information that may be useful for developers of this
102-
parser plugin.
99+
The following sections provide information that may be useful for developers of this utility.
103100

104101
### IDE's
105102

@@ -125,37 +122,16 @@ the main project directory.
125122
* Build: (plugin binary will be stored in `build/libs`)
126123
* `./gradlew clean build`: Clean and build the project
127124
* `./gradlew build`: Build the project without cleaning
128-
* `./gradlew dist`: Build distribution zip
129-
* Version management:
130-
* `./gradlew printProjectVersion`: Print the current version
131-
* `./gradlew startSnapshotBranch -PnextVersion=2.0`: Start a new snapshot branch for an upcoming `2.0` version
132-
* `./gradlew releaseSnapshot`: Merge the changes from the current branch to the master branch, and create release tag
125+
* `./gradlew dist distThirdParty`: Build distribution zip and third-party information bundle
133126
* `./fortify-scan.sh`: Run a Fortify scan; requires Fortify SCA to be installed
134127

135-
Note that the version management tasks operate only on the local repository; you will need to manually
136-
push any changes (including tags and branches) to the remote repository.
128+
### Automated Builds
137129

138-
### Versioning
130+
This project uses GitHub Actions workflows to perform automated builds for both development and production releases. All pushes to the main branch qualify for building a production release. Commits on the main branch should use [Conventional Commit Messages](https://www.conventionalcommits.org/en/v1.0.0/); it is recommended to also use conventional commit messages on any other branches.
139131

140-
The various version-related Gradle tasks assume the following versioning methodology:
132+
User-facing commits (features or fixes) on the main branch will trigger the [release-please-action](https://github.com/google-github-actions/release-please-action) to automatically create a pull request for publishing a release version. This pull request contains an automatically generated CHANGELOG.md together with a version.txt based on the conventional commit messages on the main branch. Merging such a pull request will automatically publish the production binaries and Docker images to the locations described in the [Related Links](#related-links) section.
141133

142-
* The `master` branch is only used for creating tagged release versions
143-
* A branch named `<version>-SNAPSHOT` contains the current snapshot state for the upcoming release
144-
* Optionally, other branches can be used to develop individual features, perform bug fixes, ...
145-
* However, note that the Gradle build may be unable to identify a correct version number for the project
146-
* As such, only builds from tagged versions or from a `<version>-SNAPSHOT` branch should be published to a Maven repository
147-
148-
### CI/CD
149-
150-
Travis-CI builds are automatically triggered when there is any change in the project repository,
151-
for example due to pushing changes, or creating tags or branches. If applicable, binaries and related
152-
artifacts are automatically published to Bintray using the `bintrayUpload` task:
153-
154-
* Building a tagged version will result in corresponding release version artifacts to be published
155-
* Building a branch named `<version>-SNAPSHOT` will result in corresponding beta version artifacts to be published
156-
* No artifacts will be deployed for any other build, for example when Travis-CI builds the `master` branch
157-
158-
See the [Related Links](#related-links) section for the relevant Travis-CI and Bintray links.
134+
Every push to a branch in the GitHub repository will also automatically trigger a development release to be built. By default, development releases are only published as build job artifacts. However, if a tag named `dev_<branch-name>` exists, then development releases are also published to the locations described in the [Related Links](#related-links) section. The `dev_<branch-name>` tag will be automatically updated to the commit that triggered the build.
159135

160136

161137
## License
@@ -165,4 +141,5 @@ See [LICENSE.TXT](LICENSE.TXT)
165141

166142
<x-insert text="-->"/>
167143

168-
<x-include url="file:LICENSE.TXT"/>
144+
<x-include url="file:LICENSE.TXT"/>
145+

build.gradle

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,26 @@
11
plugins {
2-
id "io.freefair.lombok" version "4.1.2"
3-
id "com.jfrog.bintray" version "1.8.4"
4-
id 'org.ajoberstar.grgit' version "4.0.0"
5-
id 'com.github.jk1.dependency-license-report' version '1.12'
6-
id "org.kordamp.gradle.markdown" version "2.0.0"
2+
id "io.freefair.lombok" version "5.3.0"
3+
id 'com.github.jk1.dependency-license-report' version '1.16'
4+
id "org.kordamp.gradle.markdown" version "2.2.0"
75
}
86

97
group 'com.fortify.ssc.parser.owasp.dependencycheck'
8+
ext.getVersion = {
9+
def result = project.findProperty('version');
10+
return result || result=='unspecified' ? new Date().format('0.yyyyMMdd.HHmmss') : result;
11+
}
12+
version = ext.getVersion();
13+
ext.sscParserPluginVersion = project.version
1014

1115
ext {
12-
gradleHelpersLocation = "https://raw.githubusercontent.com/fortify-ps/gradle-helpers/1.2"
16+
gradleHelpersLocation = "https://raw.githubusercontent.com/fortify-ps/gradle-helpers/1.5"
1317
}
1418

1519
apply from: "${gradleHelpersLocation}/repo-helper.gradle"
1620
apply from: "${gradleHelpersLocation}/junit-helper.gradle"
17-
apply from: "${gradleHelpersLocation}/version-helper.gradle"
1821
apply from: "${gradleHelpersLocation}/fortify-helper.gradle"
19-
20-
// Project and plugin version based on SCM information
21-
version = getProjectVersionAsBetaOrRelease(true)
22-
ext {
23-
sscParserPluginVersion = getProjectVersionAsPlainVersionNumber()
24-
bintrayRepo = "${getBetaOrReleaseLabel()}"
25-
bintrayPkgName = "${rootProject.name}"
26-
bintrayDownloadContainerName = getProjectVersionAsBetaOrRelease(false)
27-
projectLicense = 'MIT'
28-
}
29-
3022
apply from: "${gradleHelpersLocation}/ssc-parser-plugin-helper.gradle"
3123
apply from: "${gradleHelpersLocation}/thirdparty-helper.gradle"
32-
apply from: "${gradleHelpersLocation}/bintray-binaries-helper.gradle"
3324
apply from: "${gradleHelpersLocation}/readme2html.gradle"
3425

3526
apply plugin: 'java'
@@ -49,14 +40,14 @@ configurations.all {
4940
}
5041

5142
dependencies {
52-
compileExport(group: 'com.fortify.ssc.parser.util', name: 'json', version:'1.3', changing: false) { transitive = true }
43+
implementationExport(group: 'com.fortify.ssc.parser.util', name: 'fortify-ssc-parser-util-json', version:'1.4', changing: false) { transitive = true }
5344
}
5445

5546
task dist(type: Zip) {
5647
dependsOn 'build', 'readme2html'
5748
archiveFileName = "${rootProject.name}-${project.version}.zip"
5849
destinationDirectory = file("$buildDir/dist")
59-
from("${libsDir}") {
50+
from("${buildDir}/${libsDirName}") {
6051
include "${rootProject.name}-${project.version}.jar"
6152
}
6253
from "${buildDir}/html"
@@ -65,13 +56,3 @@ task dist(type: Zip) {
6556
include "LICENSE.TXT"
6657
}
6758
}
68-
69-
bintray {
70-
filesSpec {
71-
from("${buildDir}/dist") {
72-
include "*.zip"
73-
}
74-
into '.'
75-
}
76-
}
77-
_bintrayRecordingCopy.dependsOn 'clean', 'dist', 'distThirdParty'

gradle/wrapper/gradle-wrapper.jar

3.5 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

100644100755
Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath
@@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
154156
else
155157
eval `echo args$i`="\"$arg\""
156158
fi
157-
i=$((i+1))
159+
i=`expr $i + 1`
158160
done
159161
case $i in
160-
(0) set -- ;;
161-
(1) set -- "$args0" ;;
162-
(2) set -- "$args0" "$args1" ;;
163-
(3) set -- "$args0" "$args1" "$args2" ;;
164-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
162+
0) set -- ;;
163+
1) set -- "$args0" ;;
164+
2) set -- "$args0" "$args1" ;;
165+
3) set -- "$args0" "$args1" "$args2" ;;
166+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170172
esac
171173
fi
172174

@@ -175,14 +177,9 @@ save () {
175177
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176178
echo " "
177179
}
178-
APP_ARGS=$(save "$@")
180+
APP_ARGS=`save "$@"`
179181

180182
# Collect all arguments for the java command, following the shell quoting and substitution rules
181183
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182184

183-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185-
cd "$(dirname "$0")"
186-
fi
187-
188185
exec "$JAVACMD" "$@"

0 commit comments

Comments
 (0)