Skip to content

Commit

Permalink
📦 build zip artifacts with containing folder
Browse files Browse the repository at this point in the history
  • Loading branch information
fluffynuts committed Oct 28, 2021
1 parent 1cb560c commit 9d039a8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
25 changes: 19 additions & 6 deletions local-tasks/zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@ const
promisify = requireModule("promisify-stream"),
readCsProjVersion = requireModule("read-csproj-version"),
target = "build/artifacts",
debug = require("gulp-debug"),
rename = require("gulp-rename"),
zip = require("gulp-zip");

gulp.task("zip", [ "zip-binaries", "zip-source"], () => Promise.resolve());
gulp.task("zip", ["zip-binaries", "zip-source"], () => Promise.resolve());

gulp.task("zip-binaries", async () => {
const version = await readVersion();
const
version = await readVersion(),
baseDir = `apache-log4net-binaries-${version}`;
return promisify(
gulp.src(["build/Release/**/*", "LICENSE", "NOTICE"])
.pipe(zip(`log4net-binaries-${version}.zip`))
.pipe(rename(path => {
path.dirname = `${baseDir}/${path.dirname}`
}))
.pipe(zip(`${baseDir}.zip`))
.pipe(gulp.dest(target))
);
});

gulp.task("zip-source", async () => {
const version = await readVersion();
const
version = await readVersion(),
baseDir = `apache-log4net-source-${version}`;

return promisify(
gulp.src([
"**/*",
Expand All @@ -32,8 +42,11 @@ gulp.task("zip-source", async () => {
"!.idea",
"!.idea/**/*"
])
.pipe(zip(`log4net-source-${version}.zip`))
.pipe(gulp.dest(target))
.pipe(rename(path => {
path.dirname = `${baseDir}/${path.dirname}`
}))
.pipe(zip(`${baseDir}.zip`))
.pipe(gulp.dest(target))
);
});

Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"homepage": "https://github.com/fluffynuts/logging-log4net#readme",
"devDependencies": {
"cross-env": "^7.0.2",
"gulp-debug": "^4.0.0",
"gulp-rename": "^2.0.0",
"gulp-zip": "^5.0.2",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
Expand Down

0 comments on commit 9d039a8

Please sign in to comment.