diff --git a/.drone.yml b/.drone.yml index bdf5597..d662978 100644 --- a/.drone.yml +++ b/.drone.yml @@ -102,17 +102,21 @@ steps: - name: assets image: node:lts commands: + - git fetch -tq - npm install > /dev/null - npm run build + - cat VERSION environment: FORCE_COLOR: true NPM_CONFIG_LOGLEVEL: error - name: package - image: thegeeklab/alpine-tools + image: node:lts commands: - - echo "${DRONE_TAG:-latest}" > VERSION - - tar -zcvf dist/hugo-geekblog.tar.gz -X .tarignore . + - npm run pack + environment: + FORCE_COLOR: true + NPM_CONFIG_LOGLEVEL: error - name: checksum image: thegeeklab/alpine-tools @@ -283,6 +287,6 @@ depends_on: --- kind: signature -hmac: edaa3b55fd0fa9e3ee94e26ec12386e405da77c12f648862d8cdf5a86ece2adf +hmac: a3c1af6ac4b291e8aa1e7f9cbccb1a7c7edbf75163a36ed811c0694227a4f792 ... diff --git a/.gitignore b/.gitignore index 6f0451c..ac78d15 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ CHANGELOG.md /resources/ /exampleSite/resources/ /exampleSite/data/sprites/ +VERSION # testing .lighthouseci/ diff --git a/README.md b/README.md index ccf3080..f129d7e 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,9 @@ npm install # run the build script to build required assets npm run build + +# build release tarball +npm run pack ``` See the [Getting Started Guide](https://hugo-geekblog.geekdocs.de/posts/usage/getting-started/) for details about the different setup options. diff --git a/exampleSite/content/posts/usage/getting-started.md b/exampleSite/content/posts/usage/getting-started.md index a43aac3..feae52b 100644 --- a/exampleSite/content/posts/usage/getting-started.md +++ b/exampleSite/content/posts/usage/getting-started.md @@ -46,6 +46,9 @@ npm install # run the build script to build required assets npm run build + +# build release tarball +npm run pack ``` ## Using the theme diff --git a/package-lock.json b/package-lock.json index ed15062..2d26314 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ }, "devDependencies": { "@babel/eslint-parser": "7.18.9", + "@eloquent/git-version-webpack-plugin": "^5.0.1", "autoprefixer": "10.4.8", "copy-webpack-plugin": "11.0.0", "css-loader": "6.7.1", @@ -441,6 +442,43 @@ "node": ">=10.0.0" } }, + "node_modules/@eloquent/git-version-webpack-plugin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@eloquent/git-version-webpack-plugin/-/git-version-webpack-plugin-5.0.1.tgz", + "integrity": "sha512-p445+YEiw6U8nfaiPe3e+HhMGVdlW3q3YraD22N2oI1ldVLF9UOVHJcWWs3Nqg2JQKCNHXa4vnb6mTgEDoclSQ==", + "dev": true, + "dependencies": { + "safe-require": "^1.0.3", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "html-webpack-plugin": "^5.3.1" + }, + "peerDependencies": { + "webpack": "^5.34.0" + } + }, + "node_modules/@eloquent/git-version-webpack-plugin/node_modules/schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, "node_modules/@eslint/eslintrc": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz", @@ -9700,6 +9738,12 @@ "ret": "~0.1.10" } }, + "node_modules/safe-require": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/safe-require/-/safe-require-1.0.4.tgz", + "integrity": "sha512-1elAbSH1u7HVMfbuqktLWAN0wMOeT+FnJVqMhBgEJLvL95m+KT433tiJdGMV1e3TstQXRt1YrKQDRBu0Kpk4WA==", + "dev": true + }, "node_modules/safe-stable-stringify": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz", @@ -12953,6 +12997,30 @@ "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", "dev": true }, + "@eloquent/git-version-webpack-plugin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@eloquent/git-version-webpack-plugin/-/git-version-webpack-plugin-5.0.1.tgz", + "integrity": "sha512-p445+YEiw6U8nfaiPe3e+HhMGVdlW3q3YraD22N2oI1ldVLF9UOVHJcWWs3Nqg2JQKCNHXa4vnb6mTgEDoclSQ==", + "dev": true, + "requires": { + "html-webpack-plugin": "^5.3.1", + "safe-require": "^1.0.3", + "schema-utils": "^3.0.0" + }, + "dependencies": { + "schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + } + } + }, "@eslint/eslintrc": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz", @@ -20172,6 +20240,12 @@ "ret": "~0.1.10" } }, + "safe-require": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/safe-require/-/safe-require-1.0.4.tgz", + "integrity": "sha512-1elAbSH1u7HVMfbuqktLWAN0wMOeT+FnJVqMhBgEJLvL95m+KT433tiJdGMV1e3TstQXRt1YrKQDRBu0Kpk4WA==", + "dev": true + }, "safe-stable-stringify": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz", diff --git a/package.json b/package.json index 4efb6e4..513ae83 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "build": "run-s prep:clean prep:make svg build:webpack", "build:webpack": "webpack --mode=production", "build:webpack-devel": "webpack --mode=development", + "pack": "tar -zcvf dist/hugo-geekdoc.tar.gz -X .tarignore .", "start": "run-s prep:clean prep:make svg build:webpack-devel ; run-p start:webpack start:hugo", "start:webpack": "webpack --mode=development --watch", "start:build": "webpack --mode=development", @@ -37,6 +38,7 @@ }, "devDependencies": { "@babel/eslint-parser": "7.18.9", + "@eloquent/git-version-webpack-plugin": "^5.0.1", "autoprefixer": "10.4.8", "copy-webpack-plugin": "11.0.0", "css-loader": "6.7.1", diff --git a/webpack.config.js b/webpack.config.js index e9d143a..01f1ec7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,7 @@ const path = require("path") const glob = require("glob") const { WebpackManifestPlugin } = require("webpack-manifest-plugin") +const GitVersionPlugin = require("@eloquent/git-version-webpack-plugin") const FaviconsWebpackPlugin = require("favicons-webpack-plugin") const RemoveEmptyScriptsPlugin = require("webpack-remove-empty-scripts") const CopyPlugin = require("copy-webpack-plugin") @@ -97,6 +98,10 @@ var config = { new SRIPlugin({ sourceFile: "data/assets.json" + }), + + new GitVersionPlugin({ + path: "../VERSION" }) ] }