This is a GitHub action we used on several projects to allow our QA team to push changes from dev
to qa
branch.
The shorter version does the following:
- Updates the patch version in
package.json
ondev
- Creates new tag
- Pushes updated files to
dev
- Pushes evertything from
dev
toqa
The second version does all that, but adds one more thing:
- Writes package version to
version.js
file
We then console.log
this version on the client.
This allows us to open console and be certain which version are we looking at.
import { VERSION } from './version.js';
console.log(`Version: ${VERSION}`);
You'll need to update VERSION_FILE_PATH
to point to version.js
(you can also switch to .ts
)
- Action needs to be on your default branch
- You can run it manually by selecting it in the actions list and then clicking on "Run workflow" button:
- You can use different branch than
dev
just swap it in the yaml file (screenshot above showsmain
toqa
action). - Make sure you leave
fetch-depth: '0'
. Without it the action won't be able to rebase. I lost a few hours because of this, but luckily I found this Stack Overflow thread.