Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use Git revision in packed version, and show version in CI steps
  • Loading branch information
markerikson committed Mar 13, 2023
commit b57fd8c5111d7cd5deee28ea27f3463614a3c922
13 changes: 13 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ jobs:
- name: Install deps
run: yarn install

# Read existing version, reuse that, add a Git short hash
- name: Set build version to Git commit
run: node scripts/writeGitVersion.js $(git rev-parse --short HEAD)

- name: Check updated version
run: jq .version package.json

- name: Pack
run: yarn pack

Expand Down Expand Up @@ -123,6 +130,9 @@ jobs:
- name: Install build artifact
run: yarn add ./package.tgz

- name: Show installed RTK versions
run: yarn info @reduxjs/toolkit

- run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json ./jest.config.js ./src/tests/*.* ./src/query/tests/*.*

- name: Test types
Expand Down Expand Up @@ -170,6 +180,9 @@ jobs:
- name: Install RTK build artifact
run: yarn add ./package.tgz

- name: Show installed RTK versions
run: yarn info @reduxjs/toolkit

- name: Build example
run: yarn build

Expand Down
10 changes: 10 additions & 0 deletions packages/toolkit/scripts/writeGitVersion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path')
const fs = require('fs')

const gitRev = process.argv[2]

const packagePath = path.join(__dirname, '../package.json')
const pkg = require(packagePath)

pkg.version = `${pkg.version}-${gitRev}`
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2))