Skip to content

Commit

Permalink
feat(github-actions-release): get previous release for release note (#…
Browse files Browse the repository at this point in the history
…2315)

## Proposed change

<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that is required for this change. -->

Generate Release note from the previous version in case of minor/major
upgrade

## Related issues

- 🚀 Feature resolves #2256
  • Loading branch information
kpanot authored Oct 23, 2024
2 parents 994bfe8 + 1e9a1db commit b6e6c69
Show file tree
Hide file tree
Showing 15 changed files with 3,143 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@
"{projectRoot}/action.yml",
"{projectRoot}/LICENSE"
],
"outputs": ["{projectRoot}/packaged-action"]
"outputs": ["{projectRoot}/packaged-action"],
"dependsOn": ["build"]
}
},
"generators": {
Expand Down
17 changes: 17 additions & 0 deletions tools/github-actions/release/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable quote-props */

module.exports = {
'root': true,
'parserOptions': {
'tsconfigRootDir': __dirname,
'project': [
'tsconfig.json',
'tsconfig.eslint.json'
],
'sourceType': 'module'
},
'extends': [
'../../../.eslintrc.js'
]
};
10 changes: 9 additions & 1 deletion tools/github-actions/release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ inputs:
target:
description: 'The branch to target'
required: true
previousVersionsLimit:
description: 'Limit of previous versions to consider for the release notes'
required: false
default: '100'
runs:
using: "composite"
steps:
- name: Previous release tag
if: ${{(!contains( inputs.version, '-' )) && endsWith( inputs.version, '.0' )}}
shell: bash
run: echo "PREVIOUS_VERSION_TAG=$(gh release list --exclude-drafts --exclude-pre-releases --limit ${{ inputs.previousVersionsLimit }} --json tagName --template '[{{range .}}"{{.tagName}}",{{end}}""]{{"\n"}}' | node ./packaged-action/index.cjs ${{ inputs.version }})" >> $GITHUB_ENV
- name: Create release
shell: bash
run: gh release create v${{ inputs.version }} --generate-notes ${{ contains( inputs.version, '-' ) && '--prerelease' || '' }} --target ${{ inputs.target }}
run: gh release create v${{ inputs.version }} --generate-notes ${{ contains( inputs.version, '-' ) && '--prerelease' || '' }} --target ${{ inputs.target }} ${{ env.PREVIOUS_VERSION_TAG != '' && format('--notes-start-tag {0}', env.PREVIOUS_VERSION_TAG) || '' }}
46 changes: 46 additions & 0 deletions tools/github-actions/release/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"version": "0.0.0-placeholder",
"private": true,
"name": "release-gh-action",
"description": "Git release action provided by Otter",
"main": "tmp/get-previous-version.cjs",
"scripts": {
"nx": "nx",
"build": "tsc -b tsconfig.build.json",
"package": "ncc build --source-map --license LICENSE.txt --out packaged-action"
},
"keywords": [
"github-actions",
"github-release",
"otter"
],
"dependencies": {
"minimist": "^1.2.6",
"semver": "^7.5.2",
"tslib": "^2.6.2"
},
"devDependencies": {
"@angular-eslint/eslint-plugin": "~18.3.0",
"@nx/eslint-plugin": "~19.5.0",
"@o3r/eslint-config-otter": "workspace:~",
"@o3r/eslint-plugin": "workspace:~",
"@stylistic/eslint-plugin-ts": "~2.4.0",
"@types/minimist": "^1.2.2",
"@types/node": "^20.0.0",
"@types/semver": "^7.3.13",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@typescript-eslint/utils": "^7.14.1",
"@vercel/ncc": "~0.38.0",
"eslint": "^8.57.0",
"eslint-plugin-jest": "~28.8.0",
"eslint-plugin-jsdoc": "~48.11.0",
"eslint-plugin-prefer-arrow": "~1.2.3",
"eslint-plugin-unicorn": "^54.0.0",
"jsonc-eslint-parser": "~2.4.0",
"typescript": "~5.5.4"
},
"engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
}
}
39 changes: 39 additions & 0 deletions tools/github-actions/release/packaged-action/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b6e6c69

Please sign in to comment.