File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 exit 1
2626 fi
2727
28+ - name : Generate version.js
29+ run : |
30+ mkdir -p dist
31+ COMMIT_ID=$(git rev-parse HEAD | cut -c1-7)
32+ YEAR=$(date +%Y)
33+ VERSION=$(jq -r .version package.json)
34+ TAG=$(jq -r .version_tag package.json)
35+
36+ if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
37+ SUFFIX="prod"
38+ else
39+ SUFFIX="dev"
40+ fi
41+
42+ if [ "$TAG" != "null" ]; then
43+ FULL_VERSION="${YEAR}.${VERSION}-${TAG}-${SUFFIX}"
44+ else
45+ FULL_VERSION="${YEAR}.${VERSION}-${SUFFIX}"
46+ fi
47+
48+ echo "const version = \"$FULL_VERSION\"; const commit_id = \"$COMMIT_ID\"; module.exports = { version, commit_id };" > src/version.js
49+
50+
51+
2852 # 1️⃣ Checkout your code
2953 - name : Checkout repository
3054 uses : actions/checkout@v4
Original file line number Diff line number Diff line change 55 "description" : " A Discord music bot that features Last.fm and Discogs integration." ,
66 "main" : " index.js" ,
77 "scripts" : {
8- "build" : " tsc --diagnostics && node scripts/version.js " ,
8+ "build" : " tsc --diagnostics" ,
99 "prestart" : " tsc --diagnostics && node scripts/version.js" ,
1010 "start" : " node build/index.js" ,
11- "start:dev" : " npm run start" ,
11+ "start:dev" : " node scripts/version.js && npm run start" ,
1212 "postversion" : " node scripts/version.js" ,
1313 "test" : " echo \" Error: no test specified\" && exit 1"
1414 },
You can’t perform that action at this time.
0 commit comments