Skip to content

Commit

Permalink
updated to add revision version, and simple version to the system.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bioblaze committed Mar 9, 2024
1 parent 940825a commit ed2e835
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 3 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ The `Game-Semver-Action` is a GitHub Action designed to automatically generate a

Example: 0.0.298-alpha+build.ee9050469dca1f407c6f21361054e05181d6a9e9

### `simple_version`

Example: 0.0.298

### `revision_version`

Example: 0.0.298.0


```yaml
steps:
- name: Generate Semver/w Build SHA
Expand All @@ -38,6 +47,8 @@ steps:
### `version`

Example: 0.0.298-alpha

The generated semantic version based on your commit history and action inputs. This version can be used in subsequent workflow steps, for example, to tag a release or to update version files within your project.

To use this output in another step in your workflow, you can reference it by the step's ID. For example:
Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ inputs:
default: 'false'
outputs:
version:
description: "version generated from all commits to repo."
description: "version generated from all commits to repo"
build_version:
description: "includes build SHA added onto the version"
revision_version:
description: "a Windows assembly revision"
simple_version:
description: "a simple version without prerelease added"
runs:
using: 'node16'
main: 'dist/index.js'
Expand Down
6 changes: 6 additions & 0 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ function getAndLogCommits() {
version = parsedTagVersion;
}
});
let simpleVersion = version.format();
let revisionVersion = `${simpleVersion}.0`;
if (branchAsIdentifier && branch) {
version.prerelease = [branch.trim().replace(/[^a-zA-Z0-9-]+/g, '')];
}
Expand All @@ -214,6 +216,10 @@ function getAndLogCommits() {
core.setOutput('version', NewVersion);
core.exportVariable('build_version', newBuildVersion);
core.setOutput('build_version', newBuildVersion);
core.exportVariable('revision_version', revisionVersion);
core.setOutput('revision_version', revisionVersion);
core.exportVariable('simple_version', simpleVersion);
core.setOutput('simple_version', simpleVersion);
}
catch (error) {
if (error instanceof Error) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "lib/index.js",
"scripts": {
"build": "tsc",
"package": "ncc build --source-map --license licenses.txt"
"package": "ncc build --source-map --license licenses.txt",
"release": "npm run build && npm run package"
},
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ async function getAndLogCommits(): Promise<void> {
}
});

let simpleVersion = version.format()
let revisionVersion = `${simpleVersion}.0`;

if (branchAsIdentifier && branch) {
version.prerelease = [branch.trim().replace(/[^a-zA-Z0-9-]+/g, '')];
}
Expand All @@ -173,6 +176,10 @@ async function getAndLogCommits(): Promise<void> {
core.setOutput('version', NewVersion);
core.exportVariable('build_version', newBuildVersion);
core.setOutput('build_version', newBuildVersion);
core.exportVariable('revision_version', revisionVersion);
core.setOutput('revision_version', revisionVersion);
core.exportVariable('simple_version', simpleVersion);
core.setOutput('simple_version', simpleVersion);
} catch (error: unknown) {
if (error instanceof Error) {
core.setFailed(`An error occurred: ${error.message}`);
Expand Down

0 comments on commit ed2e835

Please sign in to comment.