diff --git a/.github/workflows/Deploy.yaml b/.github/workflows/Deploy.yaml new file mode 100644 index 0000000..3a0e194 --- /dev/null +++ b/.github/workflows/Deploy.yaml @@ -0,0 +1,28 @@ +name: Create Release + +on: + push: + tags: + - "v*.*.*" + +jobs: + create_release: + name: Publish release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: SemVer release + id: release + uses: cocogitto/cocogitto-action@main + with: + command: changelog + args: --at ${{ github.ref_name }} + + - name: Upload github release + uses: softprops/action-gh-release@v2 + with: + body: ${{ steps.release.outputs.stdout }} + tag_name: ${{ github.ref_name }} diff --git a/.github/workflows/Release.yaml b/.github/workflows/Release.yaml index 2b907ae..4519a4f 100644 --- a/.github/workflows/Release.yaml +++ b/.github/workflows/Release.yaml @@ -18,12 +18,3 @@ jobs: with: command: bump args: --check-latest-tag - - - name: Generate Changelog - run: cog changelog --at ${{ steps.release.outputs.version }} -t full_hash > GITHUB_CHANGELOG.md - - - name: Upload github release - uses: softprops/action-gh-release@v1 - with: - body_path: GITHUB_CHANGELOG.md - tag_name: ${{ steps.release.outputs.version }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e026719..25d8a33 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,8 +22,19 @@ jobs: git commit -m "docs: add Mona Lisa docs" - name: Run cocogitto-action uses: ./cocogitto-action + id: cog-check with: command: check + + - run: echo "${{ steps.cog-check.outputs.stdout }}" + + - uses: ./cocogitto-action + id: cog-changelog + with: + command: changelog + + - run: echo "${{ steps.cog-changelog.outputs.stdout }}" + test-container: runs-on: ubuntu-latest container: @@ -42,5 +53,15 @@ jobs: git commit -m "docs: add Mona Lisa docs" - name: Run cocogitto-action uses: ./cocogitto-action + id: cog-check with: command: check + + - run: echo "${{ steps.cog-check.outputs.stdout }}" + + - uses: ./cocogitto-action + id: cog-changelog + with: + command: changelog + + - run: echo "${{ steps.cog-changelog.outputs.stdout }}" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6d222cd --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,121 @@ +## [v3.11.0](https://github.com/cocogitto/cocogitto-action/compare/v3.10.0..v3.11.0) - 2025-10-18 +#### Features +- bump cocogitto to 6.3.0 - ([c7a74f5](https://github.com/cocogitto/cocogitto-action/commit/c7a74f5406bab86da17da0f0e460a69f8219a68c)) - [@oknozor](https://github.com/oknozor) +#### Bug Fixes +- use GITHUB_ACTION_PATH instead of github.action_path - ([d226c45](https://github.com/cocogitto/cocogitto-action/commit/d226c4591079402b7c2221d67ff862566b6de054)) - [@joshua-clayton](https://github.com/joshua-clayton) +#### Tests +- run cocogitto-action in a container - ([ed16f7a](https://github.com/cocogitto/cocogitto-action/commit/ed16f7a4bf7e9e928581d4d5cfd194e70a986e96)) - [@joshua-clayton](https://github.com/joshua-clayton) +#### Continuous Integration +- add a workflow_dispatch option - ([605a53a](https://github.com/cocogitto/cocogitto-action/commit/605a53a0082b10e4887a9264d34ecae2ed568ea9)) - [@joshua-clayton](https://github.com/joshua-clayton) + +- - - + +## [v3.10.0](https://github.com/cocogitto/cocogitto-action/compare/v3.9.0..v3.10.0) - 2025-10-18 +#### Features +- (**cog.sh**) handle dry run specific cases - ([2b29139](https://github.com/cocogitto/cocogitto-action/commit/2b29139be22c3c2eef16680340cede77afd9d738)) - [@sergejomon](https://github.com/sergejomon) +- bump cocogitto to 6.2.0 - ([ed62593](https://github.com/cocogitto/cocogitto-action/commit/ed62593c499c2d7697bb0177213946f1e2634119)) - [@oknozor](https://github.com/oknozor) +- add input for dry run - ([9f04182](https://github.com/cocogitto/cocogitto-action/commit/9f04182ebb5161effce9d2d6367659e700bb7adf)) - [@sergejomon](https://github.com/sergejomon) +- add input to specify package for release - ([464780f](https://github.com/cocogitto/cocogitto-action/commit/464780fa843395096b3b8371904879d54d9de9da)) - [@wittdennis](https://github.com/wittdennis) +#### Bug Fixes +- (**cog.sh**) fix white spaces ignored in sh - ([e6dcde3](https://github.com/cocogitto/cocogitto-action/commit/e6dcde3d9b778aaca9ea02ff574f6c1e3d9cd66b)) - [@sergejomon](https://github.com/sergejomon) +- (**dry-run**) fix dry run - ([f8c4784](https://github.com/cocogitto/cocogitto-action/commit/f8c47844d2cd778f8f8350ff2d198efb1142403f)) - [@sergejomon](https://github.com/sergejomon) +#### Documentation +- add package input to README.md - ([a95cd3b](https://github.com/cocogitto/cocogitto-action/commit/a95cd3b34f1e5235b58b666e52e73c24ef61a5f1)) - [@wittdennis](https://github.com/wittdennis) + +- - - + +## [v3.9.0](https://github.com/cocogitto/cocogitto-action/compare/v3.8.0..v3.9.0) - 2025-10-18 +#### Features +- (**profile**) add bump profile input - ([f1d28f8](https://github.com/cocogitto/cocogitto-action/commit/f1d28f8e65281597d8209bf233328ddfd4424d10)) - [@sergejomon](https://github.com/sergejomon) + +- - - + +## [v3.8.0](https://github.com/cocogitto/cocogitto-action/compare/v3.7.0..v3.8.0) - 2025-10-18 +#### Features +- enable use of `cog verify` in action - ([8847c89](https://github.com/cocogitto/cocogitto-action/commit/8847c8976a94ac509c518ca39fc9494661f9b15d)) - [@the-wondersmith](https://github.com/the-wondersmith) +#### Bug Fixes +- verify runs with blank text - ([5ae1660](https://github.com/cocogitto/cocogitto-action/commit/5ae166018d8265bb2df85c1eb521e86a17b61085)) - [@oradwell](https://github.com/oradwell) +#### Documentation +- suggest actions/checkout@v4 - ([64a1b79](https://github.com/cocogitto/cocogitto-action/commit/64a1b79692e7b9f9929d8bb0c6ccae98304f7d05)) - [@oradwell](https://github.com/oradwell) +#### Continuous Integration +- add ci - ([f6b07ad](https://github.com/cocogitto/cocogitto-action/commit/f6b07ad2e8576594a6178e4277ac70e03942f94d)) - [@oradwell](https://github.com/oradwell) + +- - - + +## [v3.7.0](https://github.com/cocogitto/cocogitto-action/compare/v3.6.0..v3.7.0) - 2025-10-18 +#### Features +- echo cog version in action - ([41c16c9](https://github.com/cocogitto/cocogitto-action/commit/41c16c92a95c24b4d11a0c3196f8f2ad06f5286a)) - [@nagyben](https://github.com/nagyben) +- update cocogitto to 6.1.0 - ([06d1eb4](https://github.com/cocogitto/cocogitto-action/commit/06d1eb4453e88f218c8d855d8df983224d1986dc)) - [@nagyben](https://github.com/nagyben) + +- - - + +## [v3.6.0](https://github.com/cocogitto/cocogitto-action/compare/v3.5.0..v3.6.0) - 2025-10-18 +#### Features +- update cocogitto to 6.0.1 - ([74f3572](https://github.com/cocogitto/cocogitto-action/commit/74f3572482643e11fe7f54e42714ff4ad5fa19ba)) - [@vtavernier](https://github.com/vtavernier) +- bump to 5.6.0 - ([1f7463b](https://github.com/cocogitto/cocogitto-action/commit/1f7463bd27d1c999663b1d247791cb43c758c29a)) - [@oknozor](https://github.com/oknozor) +#### Bug Fixes +- include lightweight tags in check - ([ee06dcd](https://github.com/cocogitto/cocogitto-action/commit/ee06dcd9aa0484f083b0c985432d7c7f1603f65c)) - [@lukehsiao](https://github.com/lukehsiao) + +- - - + +## [v3.5.0](https://github.com/cocogitto/cocogitto-action/compare/v3.4.0..v3.5.0) - 2025-10-18 +#### Features +- upgrade to cocogitto 5.4.0 - ([ac62601](https://github.com/cocogitto/cocogitto-action/commit/ac6260150ee57e3164cd95b47fc84cdee9e3444c)) - [@oknozor](https://github.com/oknozor) + +- - - + +## [v3.4.0](https://github.com/cocogitto/cocogitto-action/compare/v3.3.0..v3.4.0) - 2025-10-18 +#### Features +- bump to 5.3.0 - ([851938e](https://github.com/cocogitto/cocogitto-action/commit/851938eb278221bc0b2bbf82fbe14d816f73df94)) - [@oknozor](https://github.com/oknozor) + +- - - + +## [v3.3.0](https://github.com/cocogitto/cocogitto-action/compare/v3.2.0..v3.3.0) - 2025-10-18 +#### Features +- (**bump**) upgrade to 5.2.0 - ([c9f6d27](https://github.com/cocogitto/cocogitto-action/commit/c9f6d2753b2e33de09ada12cfbc1d8464b1b3ea9)) - [@stepenc](https://github.com/stepenc) +#### Documentation +- bump suggested actions/checkout version to 3 - ([dcd3132](https://github.com/cocogitto/cocogitto-action/commit/dcd3132e27c0e8cb35a7c67b75738d2c344d06da)) - [@tranzystorekk](https://github.com/tranzystorekk) + +- - - + +## [v3.2.0](https://github.com/cocogitto/cocogitto-action/compare/v3.1.0..v3.2.0) - 2025-10-18 +#### Features +- (**bump**) bump cocogitto to 5.0.1 - ([8088ae1](https://github.com/cocogitto/cocogitto-action/commit/8088ae1647b872d44bf5157dfafb205be16d97de)) - [@oknozor](https://github.com/oknozor) + +- - - + +## [v3.1.0](https://github.com/cocogitto/cocogitto-action/compare/v2.2.0..v3.1.0) - 2025-10-18 +#### Features +- (**bump**) bump cocogitto to 5.0.1 - ([55422bd](https://github.com/cocogitto/cocogitto-action/commit/55422bd6dbec477632ef9e0943d68267a2db3fa2)) - [@oknozor](https://github.com/oknozor) +- (**bump**) update cocogitto version to 5.0.0 - ([1c389ea](https://github.com/cocogitto/cocogitto-action/commit/1c389eaafef1e27d7c4b10642e8280068d040449)) - [@oknozor](https://github.com/oknozor) + +- - - + +## [v2.2.0](https://github.com/cocogitto/cocogitto-action/compare/v2.1.0..v2.2.0) - 2025-10-18 +#### Bug Fixes +- (**install.sh**) update VERSION=4.1.0 - ([5359849](https://github.com/cocogitto/cocogitto-action/commit/5359849724bd1078a64ce89a88ed50c54ce04a82)) - [@bazaah](https://github.com/bazaah) +- (**install.sh**) s/oknozor/cocogitto/ in remote url - ([cbe452e](https://github.com/cocogitto/cocogitto-action/commit/cbe452e07a865d76a07de0328c98f6a065f2d45f)) - [@bazaah](https://github.com/bazaah) +- (**readme**) Update to v2 and cocogitto GH owner - ([be31d49](https://github.com/cocogitto/cocogitto-action/commit/be31d4946f92e70ddf9939de8927c26c707a761d)) - [@mbehr1 ](https://github.com/mbehr1 ) + +- - - + +## [v2.1.0](https://github.com/cocogitto/cocogitto-action/compare/v1.2.0..v2.1.0) - 2025-10-18 +#### Features +- add binaries to path - ([4c4915c](https://github.com/cocogitto/cocogitto-action/commit/4c4915cc8a1dde177567f321eb3695bf639725bd)) - [@oknozor](https://github.com/oknozor) +- add checkout action as part of the job - ([d997156](https://github.com/cocogitto/cocogitto-action/commit/d997156daeda844c8b702372442cbeeb15b5e17d)) - [@oknozor](https://github.com/oknozor) + +- - - + +## [v1.2.0](https://github.com/cocogitto/cocogitto-action/compare/v1.1.0..v1.2.0) - 2025-10-18 +#### Features +- add version output - ([c40bc63](https://github.com/cocogitto/cocogitto-action/commit/c40bc630c23228d33054e0ee2da8824182bee54f)) - [@oknozor](https://github.com/oknozor) +- add version output - ([52ddb64](https://github.com/cocogitto/cocogitto-action/commit/52ddb648f4b525e11e58e2b94781011b2de1911f)) - [@oknozor](https://github.com/oknozor) +#### Bug Fixes +- correctly exit 1 on error - ([d4d4c32](https://github.com/cocogitto/cocogitto-action/commit/d4d4c3266e64f620c42a8e3e4b2472e146b3dd26)) - [@oknozor](https://github.com/oknozor) + +- - - + +## [v1.1.0](https://github.com/cocogitto/cocogitto-action/compare/0e988819e5b9463f0416b07b2b110bbb065df732..v1.1.0) - 2025-10-18 +#### Features +- bump cocogitto version - ([59f7bee](https://github.com/cocogitto/cocogitto-action/commit/59f7bee08df00935258be1ae3f402ef9ad8b392e)) - [@oknozor](https://github.com/oknozor) +- implement v1 with cocogitto 2.1.1 - ([8e591de](https://github.com/cocogitto/cocogitto-action/commit/8e591dee126f4cf450ba2e025c5ea977f4498e9f)) - [@oknozor](https://github.com/oknozor) diff --git a/README.md b/README.md index 17abe62..489b4eb 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,9 @@ your repository is [conventional commit](https://conventionalcommits.org/) and p ## Requirement -1. Before running this action you need to call checkout action with `fetch-depth: 0`. This is mandatory, otherwise not all commit +Before running this action you need to call checkout action with `fetch-depth: 0`. This is mandatory, otherwise not all commit will be fetched and cocogitto will fail to execute (see [actions/checkout](https://github.com/actions/checkout#checkout-v4) for more info). -2. Cocogitto assumes you are running on a x86 linux runner. - ## Example ```yaml @@ -104,6 +102,45 @@ Note that you probably want to set the `git-user` and `git-user-email` options t If you are not familiar with how cocogitto perform release, you might want to read the [auto bump](https://github.com/cocogitto/cocogitto#auto-bump) and [hook](https://github.com/cocogitto/cocogitto#auto-bump) sections on cocogitto's documentation. +## Generating a Changelog + +You can also use this action to generate a changelog for your releases. + +Here's an example of how to set up a GitHub Actions workflow to generate a changelog when a new tag is pushed: + +```yaml +name: Create Release + +on: + push: + tags: + - "v*.*.*" + +jobs: + create_release: + name: Publish release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: SemVer release + id: release + uses: cocogitto/cocogitto-action@main + with: + command: changelog + args: --at ${{ github.ref_name }} + + - name: Upload github release + uses: softprops/action-gh-release@v2 + with: + body: ${{ steps.release.outputs.stdout }} + tag_name: ${{ github.ref_name }} +``` + +In this example, the workflow is triggered on a push event when a new tag matching the pattern `v*.*.*` is created. The `cocogitto-action` is used to generate a changelog for the release, and the `softprops/action-gh-release` action is used to create a GitHub release with the generated changelog as the release body. + ## Post step run Once the step is finished cocogitto's binary will be available in your path. @@ -115,4 +152,11 @@ Here are all the inputs available through `with`: | Input | Description | Default | |-------------|--------------------------------------------------------------------------------------------------|----------------| | `command` | The cocogitto command to run (e.g., check, release) | (required) | -| `args` | Additional arguments for the cocogitto command | `""` | \ No newline at end of file +| `args` | Additional arguments for the cocogitto command | `""` | + +The following outputs are available through the GitHub `steps..outputs` context: + +| Output | Description | Default | +|-------------|--------------------------------------------------------------------------------------------------|----------------| +| `version` | The new version number after a successful release | `""` | +| `stdout` | The standard output from the cocogitto command | `""` | diff --git a/action.yml b/action.yml index 1913829..e8b4aab 100644 --- a/action.yml +++ b/action.yml @@ -31,6 +31,9 @@ outputs: version: description: Version released value: ${{ steps.cog.outputs.version }} + stdout: + description: Generated changelog + value: ${{ steps.cog.outputs.stdout }} runs: using: composite diff --git a/cog.sh b/cog.sh index 3809390..504ad4e 100755 --- a/cog.sh +++ b/cog.sh @@ -7,11 +7,11 @@ GIT_USER_EMAIL="${2}" COMMAND="${3}" ARGS="${4}" -echo "Setting git user: $GIT_USER" -git config --global user.name "$GIT_USER" +echo "Setting git user : ${GIT_USER}" +git config --global user.name "${GIT_USER}" -echo "Setting git user email: $GIT_USER_EMAIL" -git config --global user.email "$GIT_USER_EMAIL" +echo "Settings git user email ${GIT_USER_EMAIL}" +git config --global user.email "${GIT_USER_EMAIL}" cog --version @@ -21,7 +21,11 @@ if [ -z "$COMMAND" ]; then fi echo "Running command: cog $COMMAND $ARGS" -cog $COMMAND $ARGS || exit 1 +stdout="$(cog $COMMAND $ARGS 2>&1)" +echo $stdout +echo "stdout<> "$GITHUB_OUTPUT" +echo "$stdout" >> "$GITHUB_OUTPUT" +echo "EOF" >> "$GITHUB_OUTPUT" if [ "$COMMAND" = "release" ] || [ "$COMMAND" = "bump" ]; then VERSION="$(git describe --tags "$(git rev-list --tags --max-count=1)")" diff --git a/cog.toml b/cog.toml index 85e9b43..0d69b93 100644 --- a/cog.toml +++ b/cog.toml @@ -1 +1,36 @@ tag_prefix = "v" +branch_whitelist = ["main"] +ignore_merge_commits = true +ignore_fixup_commits = true + +post_bump_hooks = [ + "git push", + "git push origin {{version_tag}}", + "./major.sh {{version_tag}}", +] + +[commit_types] +chore = { omit_from_changelog = true } + +[changelog] +template = "remote" +remote = "github.com" +repository = "cocogitto-action" +owner = "cocogitto" +authors = [ + { signature = "Paul Delafosse", username = "oknozor" }, + { signature = "Joshua Clayton", username = "joshua-clayton" }, + { signature = "sergejomon", username = "sergejomon" }, + { signature = "Dennis Witt", username = "wittdennis" }, + { signature = "Guillaume Gayot", username = "sergejomon" }, + { signature = "Oliver Radwell", username = "oradwell" }, + { signature = "Mark S", username = "the-wondersmith" }, + { signature = "Serge", username = "sergejomon" }, + { signature = "Ben Nagy", username = "nagyben" }, + { signature = "Vincent Tavernier", username = "vtavernier" }, + { signature = "Luke Hsiao", username = "lukehsiao" }, + { signature = "Stephen Connolly", username = "stepenc" }, + { signature = "Marcin Puc", username = "tranzystorekk" }, + { signature = "Paul Stemmet", username = "bazaah" }, + { signature = "Matthias Behr", username = "mbehr1 " } +] diff --git a/install.sh b/install.sh index ac9b248..f0ce61f 100755 --- a/install.sh +++ b/install.sh @@ -1,12 +1,43 @@ + #!/bin/sh CUR_DIR=$(pwd) VERSION=6.3.0 -TAR="cocogitto-$VERSION-x86_64-unknown-linux-musl.tar.gz" BIN_DIR="$HOME/.local/bin" +PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]') +ARCH=$(uname -m) + +case $PLATFORM in + linux|darwin|mingw*) + case $ARCH in + x86_64|amd64) ARCH="x86_64" ;; + aarch64) ARCH="aarch64" ;; + armv7l) ARCH="armv7" ;; + *) echo "Unsupported architecture: $ARCH"; exit 1 ;; + esac + ;; + *) echo "Unsupported platform: $PLATFORM"; exit 1 ;; +esac + +case $PLATFORM in + linux) + case $ARCH in + x86_64) PLATFORM="unknown-linux-musl" ;; + aarch64) PLATFORM="unknown-linux-gnu" ;; + armv7) PLATFORM="unknown-linux-musleabihf" ;; + *) echo "Unsupported platform and architecture combination"; exit 1 ;; + esac + ;; + darwin) PLATFORM="apple-darwin" ;; + mingw*) PLATFORM="pc-windows-msvc" ;; + *) echo "Unsupported platform: $PLATFORM"; exit 1 ;; +esac + +TAR="cocogitto-$VERSION-$ARCH-$PLATFORM.tar.gz" + mkdir -p "$BIN_DIR" cd "$BIN_DIR" || exit curl -OL https://github.com/cocogitto/cocogitto/releases/download/"$VERSION"/"$TAR" -tar --strip-components=1 -xzf $TAR x86_64-unknown-linux-musl/cog +tar --strip-components=1 -xzf $TAR "$ARCH-$PLATFORM/cog" cd "$CUR_DIR" || exit diff --git a/major.sh b/major.sh new file mode 100755 index 0000000..5cc2e6a --- /dev/null +++ b/major.sh @@ -0,0 +1,9 @@ +#!/bin/sh +CURRENT_VERSION=$1 +CURRENT_MAJOR=$(echo $CURRENT_VERSION | awk -F. '{print $1}') +if ! git rev-parse $CURRENT_MAJOR >/dev/null 2>&1; then + git tag $CURRENT_MAJOR + git push origin $CURRENT_MAJOR +else + echo "$CURRENT_MAJOR already exists, skipping tagging" +fi