fix: Tag name can also be changed in pre-changelog-generation
parent
8f6aa1969f
commit
c0f41727e6
|
@ -95,7 +95,7 @@ jobs:
|
|||
uses: actions/checkout@v2
|
||||
with:
|
||||
path: "./"
|
||||
- run: test -f test-version && (echo should not be here yet && exit 1) || exit 0
|
||||
- run: test -f pre-changelog-generation.test.json && (echo should not be here yet && exit 1) || exit 0
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
uses: ./
|
||||
|
@ -107,8 +107,8 @@ jobs:
|
|||
version-file: './test-file.toml'
|
||||
skip-on-empty: 'false'
|
||||
|
||||
- run: test -f test-version || (echo should be here && exit 1)
|
||||
- run: cat test-version
|
||||
- run: test -f pre-changelog-generation.test.json || (echo should be here && exit 1)
|
||||
- run: cat pre-changelog-generation.test.json
|
||||
test-git:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
@ -59,7 +59,7 @@ A bunch of useful environment variables are available to the script with `proces
|
|||
|
||||
Same restrictions as for the pre-commit hook, but exported function name should be `preChangelogGeneration`
|
||||
|
||||
Following props will be passed to the function as a single parameter and string output with version is expected:
|
||||
Following props will be passed to the function as a single parameter and same output is expected:
|
||||
|
||||
```typescript
|
||||
interface Props {
|
||||
|
@ -67,7 +67,7 @@ interface Props {
|
|||
version: string; // Next version e.g. 1.12.3
|
||||
}
|
||||
|
||||
export function preChangelogGeneration(props: Props): string {}
|
||||
export function preChangelogGeneration(props: Props): Props {}
|
||||
```
|
||||
|
||||
### Config-File-Path
|
||||
|
|
|
@ -110,13 +110,16 @@ async function run() {
|
|||
newVersion = versioning[0].newVersion
|
||||
}
|
||||
|
||||
const gitTag = `${tagPrefix}${newVersion}`
|
||||
let gitTag = `${tagPrefix}${newVersion}`
|
||||
|
||||
if (preChangelogGeneration) {
|
||||
newVersion = await require(path.resolve(preChangelogGeneration)).preChangelogGeneration({
|
||||
const newVersionAndTag = await require(path.resolve(preChangelogGeneration)).preChangelogGeneration({
|
||||
tag: gitTag,
|
||||
version: newVersion,
|
||||
})
|
||||
|
||||
gitTag = newVersionAndTag.tag
|
||||
newVersion = newVersionAndTag.version
|
||||
}
|
||||
|
||||
// Generate the string changelog
|
||||
|
|
|
@ -9,8 +9,14 @@ exports.preChangelogGeneration = (props) => {
|
|||
t.ok(props.version, 'version should not be empty')
|
||||
|
||||
const newVersion = '1.0.100'
|
||||
const newTag = 'v1.0.100'
|
||||
|
||||
fs.writeFileSync('test-version', newVersion)
|
||||
const body = {
|
||||
version: newVersion,
|
||||
tag: newTag,
|
||||
}
|
||||
|
||||
return newVersion
|
||||
fs.writeFileSync('pre-changelog-generation.test.json', JSON.stringify(body, null, 2))
|
||||
|
||||
return body
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue