Skip to content

Commit b57fd8c

Browse files
committed
Use Git revision in packed version, and show version in CI steps
1 parent 83f2458 commit b57fd8c

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.github/workflows/tests.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ jobs:
4545
- name: Install deps
4646
run: yarn install
4747

48+
# Read existing version, reuse that, add a Git short hash
49+
- name: Set build version to Git commit
50+
run: node scripts/writeGitVersion.js $(git rev-parse --short HEAD)
51+
52+
- name: Check updated version
53+
run: jq .version package.json
54+
4855
- name: Pack
4956
run: yarn pack
5057

@@ -123,6 +130,9 @@ jobs:
123130
- name: Install build artifact
124131
run: yarn add ./package.tgz
125132

133+
- name: Show installed RTK versions
134+
run: yarn info @reduxjs/toolkit
135+
126136
- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./jest.config.js ./src/tests/*.* ./src/query/tests/*.*
127137

128138
- name: Test types
@@ -170,6 +180,9 @@ jobs:
170180
- name: Install RTK build artifact
171181
run: yarn add ./package.tgz
172182

183+
- name: Show installed RTK versions
184+
run: yarn info @reduxjs/toolkit
185+
173186
- name: Build example
174187
run: yarn build
175188

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const path = require('path')
2+
const fs = require('fs')
3+
4+
const gitRev = process.argv[2]
5+
6+
const packagePath = path.join(__dirname, '../package.json')
7+
const pkg = require(packagePath)
8+
9+
pkg.version = `${pkg.version}-${gitRev}`
10+
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2))

0 commit comments

Comments
 (0)