Skip to content

Commit

Permalink
ci: Modifies release action (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
frtibble authored May 22, 2024
1 parent 7621f8c commit 96cc779
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 44 deletions.
54 changes: 36 additions & 18 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,42 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v5
- uses: codfish/semantic-release-action@v3
id: semantic
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
output-file: 'CHANGELOG.md'
git-user-name: 'github-actions[bot]'
git-user-email: 'github-actions[bot]@users.noreply.github.com'
version-file: './pyproject.toml'
version-path: 'tool.poetry.version'

tag-format: 'v${version}'
additional-packages: |
['conventional-changelog-conventionalcommits@7']
plugins: |
[
'@semantic-release/commit-analyzer',
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{ type: 'feat', section: 'Features', hidden: false },
{ type: 'fix', section: 'Bug Fixes', hidden: false },
{ type: 'perf', section: 'Performance Improvements', hidden: false },
{ type: 'revert', section: 'Reverts', hidden: false },
{ type: 'docs', section: 'Other Updates', hidden: false },
{ type: 'style', section: 'Other Updates', hidden: false },
{ type: 'chore', section: 'Other Updates', hidden: false },
{ type: 'refactor', section: 'Other Updates', hidden: false },
{ type: 'test', section: 'Other Updates', hidden: false },
{ type: 'build', section: 'Other Updates', hidden: false },
{ type: 'ci', section: 'Other Updates', hidden: false }
]
}
}
],
'@semantic-release/github'
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: echo ${{ steps.semantic.outputs.release-version }}

- name: Create Release
uses: actions/create-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
- run: echo "$OUTPUTS"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
OUTPUTS: ${{ toJson(steps.semantic.outputs) }}
24 changes: 0 additions & 24 deletions CHANGELOG.md

This file was deleted.

4 changes: 3 additions & 1 deletion docs/RELEASE_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ Once a PR is merged to `main`, the Action will automatically run. It will automa

Once a merge to `main` is completed that would result in a major/minor/patch version increase (such as `feat`, `fix`, etc.) then a changelog will be generated, and this will trigger a release to be published automatically with the appropriate version number.

The workflow is configured so that the `CHANGELOG.md` is continuously updated. The Action by default uses the `package.json` version, which it also automatically updates.
By default, `semantic-release` only includes `fix`, `feat`, and `perf` commit types in the release. Our project includes all commit types in their release notes, while still using `semantic-release`'s commit analyzer to only create releases for `fix`, `feat`, and `perf` commits.

Note that, it is not possible to automate the update of a `CHANGELOG` as this would require the GitHub token to have permissions to push commits to the repository, which cannot be enabled.

## Security

Expand Down
2 changes: 1 addition & 1 deletion docs/design/adrs/2024-05-02-enable-project-versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ Pros:
- When introducing automated versioning, there are a few things we need to consider:
- **major/minor/patch** versions: Each release is tagged with a semantic version which is based on the change included (e.g. breaking change, feature, bug fix).
- **Changelog**: A changelog must be included which details the changes that are included in the release.
- The [**conventional-changelog-action**](https://github.com/TriPSs/conventional-changelog-action) GitHub Action automates releases. It looks at commit messages to automatically generate the version number and to generate the changelog.
- The [**semantic-release-action**](https://github.com/codfish/semantic-release-action?tab=readme-ov-file#semantic-release-action) GitHub Action automates releases. It looks at commit messages to automatically generate the version number and to generate the changelog.
- It uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), meaning we'd need to follow a convention of labelling PRs with `fix`/`feat`/`BREAKING CHANGE`, etc, in order to be picked up by the release generator. It uses these labels to create the correct version.
- As a consequence, current dependabot PRs would not trigger a release PR. These would be in main until an automatic or manual release was triggered.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "chat-with-your-data",
"version": "1.1.0",
"private": true
}

0 comments on commit 96cc779

Please sign in to comment.