Add date/hash outputs

This commit is contained in:
Anand Chowdhary
2021-05-03 11:37:17 +02:00
parent 49f2fd0fff
commit 2a8b5ec1bc
2 changed files with 11 additions and 7 deletions

View File

@@ -35,13 +35,15 @@ jobs:
### Outputs
| Output name | Description | Example value |
| ---------------------------- | ------------------------ | ------------------ |
| `package-version` | Latest release version | v2.23.1 |
| `package-version-timestamp` | Version + unix timestamp | v2.23.1-1609693587 |
| `short-hash` | Last commit hash | 1abc9c3 |
| `package-version-short-hash` | Version + commit hash | v2.23.1-1abc9c3 |
| `package-version-random` | Version + random string | v2.23.1-238a32ef21 |
| Output name | Description | Example value |
| ---------------------------- | -------------------------- | ----------------------------------- |
| `package-version` | Latest release version | v2.23.1 |
| `package-version-timestamp` | Version + unix timestamp | v2.23.1-1609693587 |
| `short-hash` | Last commit hash | 1abc9c3 |
| `package-version-short-hash` | Version + commit hash | v2.23.1-1abc9c3 |
| `package-version-random` | Version + random string | v2.23.1-238a32ef21 |
| `date-hash` | Date + commit hash | 2020-12-29-238a32ef21 |
| `date-time-hash` | ISO datetime + commit hash | 2020-12-29T09:35:34.759Z-238a32ef21 |
## 📄 License

View File

@@ -18,6 +18,8 @@ export const run = async () => {
);
const hash = execSync("git rev-parse --short HEAD", { encoding: "utf8" }).trim();
setOutput("short-hash", hash);
setOutput("date-short-hash", `${new Date().toISOString().substr(0, 10)}-${hash}`);
setOutput("date-time-short-hash", `${new Date().toISOString()}-${hash}`);
setOutput("package-version-short-hash", `${lastVersion}-${hash}`);
setOutput(
"package-version-random",