Skip to content

Commit f304e6f

Browse files
committed
Prep for release
1 parent 7cf0359 commit f304e6f

File tree

5 files changed

+261
-20
lines changed

5 files changed

+261
-20
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ jobs:
2929
runs-on: ubuntu-20.04
3030
steps:
3131
- name: Checkout Repository
32-
uses: actions/checkout@v3
32+
uses: actions/checkout@v4
3333

3434
- name: Setup CommandBox
3535
uses: Ortus-Solutions/[email protected]
3636
with:
3737
forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }}
3838

39+
- name: Setup Gradle
40+
uses: gradle/gradle-build-action@v3
41+
with:
42+
gradle-version: "8.7"
43+
3944
- name: "Setup Environment Variables For Build Process"
4045
id: current_version
4146
run: |
@@ -60,8 +65,7 @@ jobs:
6065
run: |
6166
npm install -g markdownlint-cli
6267
markdownlint changelog.md --fix
63-
box install commandbox-docbox
64-
box task run taskfile=build/Build target=run :version=${{ env.VERSION }} :projectName=${{ env.MODULE_ID }} :buildID=${{ github.run_number }} :branch=${{ env.BRANCH }}
68+
box task run taskfile=tasks/Build :version=${{ env.VERSION }} :projectName=${{ env.MODULE_ID }} :buildID=${{ github.run_number }} :branch=${{ env.BRANCH }}
6569
6670
- name: Commit Changelog To Master
6771
uses: EndBug/[email protected]
@@ -82,7 +86,7 @@ jobs:
8286

8387
- name: Upload Build Artifacts
8488
if: success()
85-
uses: actions/upload-artifact@v3
89+
uses: actions/upload-artifact@v4
8690
with:
8791
name: ${{ env.MODULE_ID }}
8892
path: |
@@ -100,17 +104,6 @@ jobs:
100104
SOURCE_DIR: ".artifacts/${{ env.MODULE_ID }}"
101105
DEST_DIR: "ortussolutions/coldbox-modules/${{ env.MODULE_ID }}"
102106

103-
# - name: Upload API Docs to S3
104-
# uses: jakejarvis/s3-sync-action@master
105-
# with:
106-
# args: --acl public-read
107-
# env:
108-
# AWS_S3_BUCKET: "apidocs.ortussolutions.com"
109-
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
110-
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
111-
# SOURCE_DIR: ".tmp/apidocs"
112-
# DEST_DIR: "coldbox-modules/${{ env.MODULE_ID }}/${{ env.VERSION }}"
113-
114107
- name: Publish To ForgeBox
115108
if: env.SNAPSHOT == 'false'
116109
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ modules/**
1919

2020
# log files
2121
logs/**
22+
lib/cbsso-opensaml-all.jar

changelog.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [Unreleased]
1111

12-
## [1.0.0] => 2021-JAN-01
13-
14-
* First iteration of this module
12+
* Add support for several SSO IP integrations

tasks/Build.cfc

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
/**
2+
* Build process for ColdBox Modules
3+
* Adapt to your needs.
4+
*/
5+
component {
6+
7+
/**
8+
* Constructor
9+
*/
10+
function init(){
11+
// Setup Pathing
12+
variables.cwd = getCWD().reReplace( "[\\/]$", "" );
13+
variables.artifactsDir = cwd & "/.artifacts";
14+
variables.buildDir = cwd & "/.tmp";
15+
16+
// Source Excludes Not Added to final binary
17+
variables.excludes = [
18+
"build",
19+
"java",
20+
"resources",
21+
"test-harness",
22+
"server-.*\.json",
23+
"^\..*",
24+
".git",
25+
".tmp",
26+
".artifacts",
27+
".engine"
28+
];
29+
30+
// Cleanup + Init Build Directories
31+
[
32+
variables.buildDir,
33+
variables.artifactsDir
34+
].each( function( item ){
35+
if ( directoryExists( item ) ) {
36+
directoryDelete( item, true );
37+
}
38+
// Create directories
39+
directoryCreate( item, true, true );
40+
} );
41+
42+
return this;
43+
}
44+
45+
/**
46+
* Run the build process: test, build source, docs, checksums
47+
*
48+
* @projectName The project name used for resources and slugs
49+
* @version The version you are building
50+
* @buldID The build identifier
51+
* @branch The branch you are building
52+
*/
53+
function run(
54+
required projectName,
55+
version = "1.0.0",
56+
buildID = createUUID(),
57+
branch = "development"
58+
){
59+
// Create project mapping
60+
fileSystemUtil.createMapping( arguments.projectName, variables.cwd );
61+
62+
buildJavaDeps();
63+
64+
// Build the source
65+
buildSource( argumentCollection = arguments );
66+
67+
// checksums
68+
buildChecksums();
69+
70+
// Finalize Message
71+
print
72+
.line()
73+
.boldMagentaLine( "Build Process is done! Enjoy your build!" )
74+
.toConsole();
75+
}
76+
77+
function buildJavaDeps(){
78+
task( "tasks/BuildJavaDeps" )
79+
.inWorkingDirectory( variables.cwd )
80+
.run();
81+
}
82+
83+
/**
84+
* Build the source
85+
*
86+
* @projectName The project name used for resources and slugs
87+
* @version The version you are building
88+
* @buldID The build identifier
89+
* @branch The branch you are building
90+
*/
91+
function buildSource(
92+
required projectName,
93+
version = "1.0.0",
94+
buildID = createUUID(),
95+
branch = "development"
96+
){
97+
// Build Notice ID
98+
print
99+
.line()
100+
.boldMagentaLine(
101+
"Building #arguments.projectName# v#arguments.version#+#arguments.buildID# from #cwd# using the #arguments.branch# branch."
102+
)
103+
.toConsole();
104+
105+
ensureExportDir( argumentCollection = arguments );
106+
107+
// Project Build Dir
108+
variables.projectBuildDir = variables.buildDir & "/#projectName#";
109+
directoryCreate(
110+
variables.projectBuildDir,
111+
true,
112+
true
113+
);
114+
115+
// Copy source
116+
print.blueLine( "Copying source to build folder..." ).toConsole();
117+
copy(
118+
variables.cwd,
119+
variables.projectBuildDir
120+
);
121+
122+
// Create build ID
123+
fileWrite(
124+
"#variables.projectBuildDir#/#projectName#-#version#+#buildID#",
125+
"Built with love on #dateTimeFormat( now(), "full" )#"
126+
);
127+
128+
// Updating Placeholders
129+
print.greenLine( "Updating version identifier to #arguments.version#" ).toConsole();
130+
command( "tokenReplace" )
131+
.params(
132+
path = "/#variables.projectBuildDir#/**",
133+
token = "@build.version@",
134+
replacement = arguments.version
135+
)
136+
.run();
137+
138+
print.greenLine( "Updating build identifier to #arguments.buildID#" ).toConsole();
139+
command( "tokenReplace" )
140+
.params(
141+
path = "/#variables.projectBuildDir#/**",
142+
token = ( arguments.branch == "master" ? "@build.number@" : "[email protected]@" ),
143+
replacement = ( arguments.branch == "master" ? arguments.buildID : "-snapshot" )
144+
)
145+
.run();
146+
147+
// zip up source
148+
var destination = "#variables.exportsDir#/#projectName#-#version#.zip";
149+
print.greenLine( "Zipping code to #destination#" ).toConsole();
150+
cfzip(
151+
action = "zip",
152+
file = "#destination#",
153+
source = "#variables.projectBuildDir#",
154+
overwrite = true,
155+
recurse = true
156+
);
157+
158+
// Copy box.json for convenience
159+
fileCopy(
160+
"#variables.projectBuildDir#/box.json",
161+
variables.exportsDir
162+
);
163+
}
164+
165+
166+
/********************************************* PRIVATE HELPERS *********************************************/
167+
168+
/**
169+
* Build Checksums
170+
*/
171+
private function buildChecksums(){
172+
print.greenLine( "Building checksums" ).toConsole();
173+
command( "checksum" )
174+
.params(
175+
path = "#variables.exportsDir#/*.zip",
176+
algorithm = "SHA-512",
177+
extension = "sha512",
178+
write = true
179+
)
180+
.run();
181+
command( "checksum" )
182+
.params(
183+
path = "#variables.exportsDir#/*.zip",
184+
algorithm = "md5",
185+
extension = "md5",
186+
write = true
187+
)
188+
.run();
189+
}
190+
191+
/**
192+
* DirectoryCopy is broken in lucee
193+
*/
194+
private function copy( src, target, recurse = true ){
195+
// process paths with excludes
196+
directoryList(
197+
src,
198+
false,
199+
"path",
200+
function( path ){
201+
var isExcluded = false;
202+
variables.excludes.each( function( item ){
203+
if ( path.replaceNoCase( variables.cwd, "", "all" ).reFindNoCase( item ) ) {
204+
isExcluded = true;
205+
}
206+
} );
207+
return !isExcluded;
208+
}
209+
).each( function( item ){
210+
// Copy to target
211+
if ( fileExists( item ) ) {
212+
print.blueLine( "Copying #item#" ).toConsole();
213+
fileCopy( item, target );
214+
} else {
215+
print.greenLine( "Copying directory #item#" ).toConsole();
216+
directoryCopy(
217+
item,
218+
target & "/" & item.replace( src, "" ),
219+
true
220+
);
221+
}
222+
} );
223+
}
224+
225+
/**
226+
* Gets the last Exit code to be used
227+
**/
228+
private function getExitCode(){
229+
return ( createObject( "java", "java.lang.System" ).getProperty( "cfml.cli.exitCode" ) ?: 0 );
230+
}
231+
232+
/**
233+
* Ensure the export directory exists at artifacts/NAME/VERSION/
234+
*/
235+
private function ensureExportDir(
236+
required projectName,
237+
version = "1.0.0"
238+
){
239+
if ( structKeyExists( variables, "exportsDir" ) && directoryExists( variables.exportsDir ) ){
240+
return;
241+
}
242+
// Prepare exports directory
243+
variables.exportsDir = variables.artifactsDir & "/#projectName#/#arguments.version#";
244+
directoryCreate( variables.exportsDir, true, true );
245+
}
246+
}e

task.cfc renamed to tasks/BuildJavaDeps.cfc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ component {
88
*/
99
function run() {
1010

11-
var rootDir = getCWD();
12-
11+
var rootDir = getCWD().reReplace( "[\\/]$", "" );
12+
13+
print.line( rootDir );
14+
return;
15+
1316
command( "run" )
1417
.inWorkingDirectory( rootDir & "/java/cbsso-opensaml" )
1518
.params( "gradlew", ":app:shadowJar" )

0 commit comments

Comments
 (0)