forked from cocogitto/cocogitto-action
-
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.
* action outputs expose boolean flag indicating if bump happenend * added tests and improved assertions Signed-off-by: Ievgenii Shepeliuk <[email protected]>
- Loading branch information
1 parent
5ae1660
commit ab04659
Showing
4 changed files
with
113 additions
and
15 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,84 @@ | ||
name: CI cog release | ||
|
||
on: | ||
workflow_dispatch: {} | ||
push: {} | ||
|
||
jobs: | ||
no-bump-has-prev: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: cocogitto-action | ||
- name: Initialise repository | ||
run: | | ||
git init | ||
git config --global user.name 'Mona Lisa' | ||
git config --global user.email '[email protected]' | ||
git commit --allow-empty -m 'feat: initial' | ||
git tag '0.1.0' | ||
echo 'cocogitto-action/' > .gitignore | ||
echo '# Mona Lisa' > README.md | ||
git add README.md .gitignore | ||
git commit -m 'chore: add Mona Lisa docs' | ||
- name: Run cocogitto-action | ||
id: release | ||
uses: ./cocogitto-action | ||
with: | ||
check: true | ||
release: true | ||
- name: Check outputs | ||
run: | | ||
[ "${{ steps.release.outputs.version }}" == '0.1.0' ] || exit 1 | ||
[ -z "${{ steps.release.outputs.bumped }}" ] || exit 1 | ||
no-bump-no-prev: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: cocogitto-action | ||
- name: Initialise repository | ||
run: | | ||
git init | ||
git config --global user.name 'Mona Lisa' | ||
git config --global user.email '[email protected]' | ||
echo 'cocogitto-action/' > .gitignore | ||
echo '# Mona Lisa' > README.md | ||
git add README.md .gitignore | ||
git commit -m 'chore: add Mona Lisa docs' | ||
- name: Run cocogitto-action | ||
id: release | ||
uses: ./cocogitto-action | ||
with: | ||
check: true | ||
release: true | ||
- name: Check outputs | ||
run: | | ||
[ -z "${{ steps.release.outputs.version }}" ] || exit 1 | ||
[ -z "${{ steps.release.outputs.bumped }}" ] || exit 1 | ||
bump-no-prev: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: cocogitto-action | ||
- name: Initialise repository | ||
run: | | ||
git init | ||
git config --global user.name 'Mona Lisa' | ||
git config --global user.email '[email protected]' | ||
echo 'cocogitto-action/' > .gitignore | ||
echo '# Mona Lisa' > README.md | ||
git add README.md .gitignore | ||
git commit -m 'feat: add Mona Lisa docs' | ||
- name: Run cocogitto-action | ||
id: release | ||
uses: ./cocogitto-action | ||
with: | ||
check: true | ||
release: true | ||
- name: Check outputs | ||
run: | | ||
[ "${{ steps.release.outputs.version }}" == '0.1.0' ] || exit 1 | ||
[ "${{ steps.release.outputs.bumped }}" == 'true' ] || exit 1 |
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 |
---|---|---|
|
@@ -91,9 +91,13 @@ You can also use this action to perform releases (calling `cog bump --auto` unde | |
git-user: 'Cog Bot' | ||
git-user-email: '[email protected]' | ||
# The version number is accessible as a github action output | ||
- name: Print version | ||
run: "echo '${{ steps.release.outputs.version }}'" | ||
# The version number is accessible as the action output. | ||
# Also the action output contains flag, | ||
# indicating if version was bumped or not. | ||
- name: Print version if changed | ||
if: ${{ steps.release.outputs.bumped }} | ||
run: | | ||
echo "new version: ${{ steps.release.outputs.version }}" | ||
``` | ||
|
||
Note that you probably want to set the `git-user` and `git-user-email` options to override the default the git signature for the release commit. | ||
|
@@ -110,8 +114,8 @@ Here are all the inputs available through `with`: | |
|
||
| Input | Description | Default | | ||
| ------------------- | -------------------------------------------------------------------------- | ------- | | ||
| `check` | Check conventional commit compliance with `cog check` | `true` | | ||
| `check-latest-tag-only` | Check conventional commit compliance with `cog check --from-latest-tag` | `false` | | ||
| `release` | Perform a release using `cog bump --auto` | `false` | | ||
| `git-user` | Set the git `user.name` to use for the release commit | `cog-bot`| | ||
| `git-user-email` | Set the git `user.email` to use for the release commit | `[email protected]`| | ||
| `check` | Check conventional commit compliance with `cog check` | `true` | | ||
| `check-latest-tag-only` | Check conventional commit compliance with `cog check --from-latest-tag` | `false` | | ||
| `release` | Perform a release using `cog bump --auto` | `false` | | ||
| `git-user` | Set the git `user.name` to use for the release commit | `cog-bot`| | ||
| `git-user-email` | Set the git `user.email` to use for the release commit | `[email protected]`| |
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
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