-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add release github action to auto bump versions
- Loading branch information
1 parent
8f08d1a
commit ab174a4
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This action will update the CITATION.cff file for new release or hotfix branches | ||
|
||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'release/**' | ||
- 'hotfix/**' | ||
|
||
jobs: | ||
citation-update: | ||
name: Update CITATION.cff | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Autoformat CITATION.cff | ||
run: | | ||
version=`grep -o '\d\+\.\d\+\.\d\+' package.json` | ||
today=`date +"%Y-%m-%d"` | ||
sed -i "s/^version: [[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\.[[:digit:]]\{1,\}/version: $version/" CITATION.cff | ||
sed -i "s/[[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}/$today/" CITATION.cff | ||
bash ./update-citation.sh | ||
git commit -a -m "update version and date in CITATION.cff" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,3 +49,7 @@ Thumbs.db | |
|
||
# Angular | ||
.angular/ | ||
|
||
|
||
/src/environments/environment.prod.ts | ||
/src/environments/version.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const path = require('path'); | ||
const colors = require('colors/safe'); | ||
const fs = require('fs'); | ||
|
||
console.log(colors.cyan('\nRunning pre-build tasks')); | ||
|
||
var appVersion; | ||
|
||
try { | ||
appVersion = require('../../package.json').version; | ||
} catch { | ||
console.warn('Could not import package.json.'); | ||
appVersion = undefined; | ||
} | ||
|
||
const versionFilePath = path.join( | ||
__dirname + '/../src/environments/version.ts' | ||
); | ||
const src = `export const version = '${appVersion}'; | ||
`; | ||
|
||
// ensure version module pulls value from package.json | ||
fs.writeFile(versionFilePath, src, { flat: 'w' }, function (err) { | ||
if (err) { | ||
return console.log(colors.red(err)); | ||
} | ||
|
||
console.log( | ||
colors.green( | ||
`Updating application version ${colors.yellow(appVersion)}` | ||
) | ||
); | ||
console.log( | ||
`${colors.green('Writing version module to ')}${colors.yellow( | ||
versionFilePath | ||
)}\n` | ||
); | ||
console.log(src); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters