From a0f6c9fafb3f38cc3e6fb53275dca94ec03e97c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Cerqueira?= Date: Tue, 14 Sep 2021 08:20:54 +0100 Subject: [PATCH 1/3] feat: add version output --- action.yml | 3 +++ entrypoint.sh | 2 ++ 2 files changed, 5 insertions(+) diff --git a/action.yml b/action.yml index 075f480..7d2ebfa 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,9 @@ runs: branding: icon: 'git-commit' color: 'purple' +outputs: + version: + description: 'New version' inputs: dry_run: description: 'Run without creating commit, output to stdout' diff --git a/entrypoint.sh b/entrypoint.sh index 3ecad02..4c04b28 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -43,6 +43,8 @@ fi export REV=`cz version --project` echo "REVISION=$REV" >> $GITHUB_ENV +echo "::set-output name=version::$REV" + echo "Pushing to branch..." remote_repo="https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${REPOSITORY}.git" git pull ${remote_repo} ${INPUT_BRANCH} From 3e8e796cff03547fd208761e93208114fce72c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Cerqueira?= Date: Tue, 14 Sep 2021 08:22:38 +0100 Subject: [PATCH 2/3] docs: document version output and REVISION env var --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 9f6bc4f..2118b6a 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,14 @@ jobs: +## Outputs + +| Name | Description | +| --------- | -------------------- | +| `version` | The new version | + +Additionally, the new version is also availble as an environment variable under `REVISION`. + ## Troubleshooting ### Other actions are not triggered when the tag is pushed From 8e97e709bcbc5ce6674b33230350b91cc23b7f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Cerqueira?= Date: Tue, 14 Sep 2021 10:52:12 +0100 Subject: [PATCH 3/3] docs: added version output to sample workflow --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2118b6a..9475ac8 100644 --- a/README.md +++ b/README.md @@ -53,10 +53,13 @@ jobs: with: fetch-depth: 0 token: "${{ secrets.GITHUB_TOKEN }}" - - name: Create bump and changelog + - id: cz + name: Create bump and changelog uses: commitizen-tools/commitizen-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Print Version + run: echo "Bumped to version ${{ steps.cz.outputs.version }}" ``` ## Variables