fix: use GITHUB env for git short hash

This commit is contained in:
Alexis Tyler
2021-06-28 20:10:05 +09:30
parent bf87b0d5b8
commit b964ae9f73
2 changed files with 5 additions and 2 deletions
+5 -1
View File
@@ -181,7 +181,11 @@ jobs:
- name: Add commit hash to version
if: startsWith(github.ref, 'refs/tags/v') == false
run: npm run mark-version-commit
run: |
VERSION=$(jq -r .version package.json) && \
SHORT_HASH=$(echo $GITHUB_SHA | cut -c 1-7) && \
jq --arg version \"$VERSION-$SHORT_HASH\" '.version = $version' package.json > package.json && \
echo '✔ Version field updated'
- name: Build binary
run: npm run build-binary
-1
View File
@@ -12,7 +12,6 @@
"build-binary-step-1": "nexe ./dist/cli.js --make=\"-j$(nproc 2> /dev/null || echo 1)\" -r './dist/**/*' -r './node_modules' && mv ./cli ./unraid-api && echo '✔ Binary built: ./unraid-api'",
"build-binary-step-2": "rm -rf ./node_modules && rm -rf ./dist && echo '✔ Source files deleted'",
"build-binary": "npm run build-binary-step-1 && npm run build-binary-step-2",
"mark-version-commit": "VERSION=$(jq -r .version package.json) && SHORT_HASH=$(git rev-parse --short HEAD) && jq --arg version \"$VERSION-$SHORT_HASH\" '.version = $version' package.json > package.json && echo '✔ Version field updated'",
"copy-schemas": "cpx app/**/*.graphql dist/types",
"clean": "modclean --no-progress --run --path .",
"commit": "npx git-cz",