Merge pull request #191 from pdreker/fix/honour-pre-release-flag-for-default-version

fix: honour pre-release flag for default version
releases/v3
Tycho Bokdam 2022-11-23 19:49:12 +01:00 committed by GitHub
commit 5a9215811d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 238 additions and 202 deletions

View File

@ -1,4 +1,4 @@
name: 'Test the action' name: "Test the action"
on: on:
pull_request: pull_request:
branches: branches:
@ -24,11 +24,11 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v1.5.0' EXPECTED_TAG: "v1.5.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file.json' version-file: "test-file.json"
- name: Show file - name: Show file
run: | run: |
@ -38,7 +38,7 @@ jobs:
run: node ./test-github-output.js run: node ./test-github-output.js
env: env:
TAG: ${{ steps.changelog.outputs.tag }} TAG: ${{ steps.changelog.outputs.tag }}
EXPECTED_TAG: 'v1.5.0' EXPECTED_TAG: "v1.5.0"
test-json: test-json:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -58,11 +58,11 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v1.5.0' EXPECTED_TAG: "v1.5.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file.json' version-file: "test-file.json"
- name: Show file - name: Show file
run: | run: |
@ -71,8 +71,8 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file.json' FILES: "test-file.json"
EXPECTED_VERSION: '1.5.0' EXPECTED_VERSION: "1.5.0"
test-json-new: test-json-new:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -92,11 +92,11 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.1.0' EXPECTED_TAG: "v0.1.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file-new.json' version-file: "test-file-new.json"
- name: Show file - name: Show file
run: | run: |
@ -105,8 +105,43 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file-new.json' FILES: "test-file-new.json"
EXPECTED_VERSION: '0.1.0' EXPECTED_VERSION: "0.1.0"
test-json-new-prerelease:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "./"
- run: npm ci --prod
- run: "git config --global user.email 'changelog@github.com'"
- run: "git config --global user.name 'Awesome Github action'"
- run: "git add . && git commit --allow-empty -m 'feat: Added fake file so version will be bumped'"
- name: Generate changelog
id: changelog
uses: ./
env:
ENV: "dont-use-git"
EXPECTED_TAG: "v0.1.0-rc.0"
with:
github-token: ${{ secrets.github_token }}
version-file: "test-file-new-prerelease.json"
pre-release: true
- name: Show file
run: |
echo "$(<test-file-new-prerelease.json)"
- name: Test output
run: node ./test-output.js
env:
FILES: "test-file-new-prerelease.json"
EXPECTED_VERSION: "0.1.0-rc.0"
test-json-empty: test-json-empty:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -128,19 +163,19 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.1.0' EXPECTED_TAG: "v0.1.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: './test-file-empty.json' version-file: "./test-file-empty.json"
- run: echo "$(<./test-file-empty.json)" - run: echo "$(<./test-file-empty.json)"
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file-empty.json' FILES: "test-file-empty.json"
EXPECTED_VERSION: '0.1.0' EXPECTED_VERSION: "0.1.0"
test-git: test-git:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -164,13 +199,13 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.55.9' EXPECTED_TAG: "v0.55.9"
SKIPPED_COMMIT: true SKIPPED_COMMIT: true
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
skip-commit: 'true' skip-commit: "true"
test-git-no-pull: test-git-no-pull:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -193,14 +228,14 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.55.9' EXPECTED_TAG: "v0.55.9"
SKIPPED_COMMIT: true SKIPPED_COMMIT: true
SKIPPED_PULL: true SKIPPED_PULL: true
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
skip-commit: 'true' skip-commit: "true"
skip-git-pull: 'true' skip-git-pull: "true"
test-git-fallback: test-git-fallback:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -222,12 +257,12 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.1.0' EXPECTED_TAG: "v0.1.0"
SKIPPED_COMMIT: true SKIPPED_COMMIT: true
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
skip-commit: 'true' skip-commit: "true"
test-git-no-push: test-git-no-push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -251,14 +286,14 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.55.9' EXPECTED_TAG: "v0.55.9"
SKIPPED_COMMIT: true SKIPPED_COMMIT: true
EXPECTED_NO_PUSH: true EXPECTED_NO_PUSH: true
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
skip-commit: 'true' skip-commit: "true"
git-push: 'false' git-push: "false"
test-yaml: test-yaml:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -278,32 +313,32 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v9.5.0' EXPECTED_TAG: "v9.5.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file.yaml' version-file: "test-file.yaml"
version-path: 'package.version' version-path: "package.version"
- name: Generate changelog - name: Generate changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v9.6.0' EXPECTED_TAG: "v9.6.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file.yaml' version-file: "test-file.yaml"
version-path: 'package.no-quotes-version' version-path: "package.no-quotes-version"
- name: Generate changelog - name: Generate changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v9.7.0' EXPECTED_TAG: "v9.7.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file.yaml' version-file: "test-file.yaml"
version-path: 'package.double-quotes-version' version-path: "package.double-quotes-version"
- name: Show file - name: Show file
run: | run: |
@ -312,23 +347,23 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file.yaml' FILES: "test-file.yaml"
EXPECTED_VERSION: '9.5.0' EXPECTED_VERSION: "9.5.0"
EXPECTED_VERSION_PATH: 'package.version' EXPECTED_VERSION_PATH: "package.version"
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file.yaml' FILES: "test-file.yaml"
EXPECTED_VERSION: '9.6.0' EXPECTED_VERSION: "9.6.0"
EXPECTED_VERSION_PATH: 'package.no-quotes-version' EXPECTED_VERSION_PATH: "package.no-quotes-version"
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file.yaml' FILES: "test-file.yaml"
EXPECTED_VERSION: '9.7.0' EXPECTED_VERSION: "9.7.0"
EXPECTED_VERSION_PATH: 'package.double-quotes-version' EXPECTED_VERSION_PATH: "package.double-quotes-version"
test-yaml-new: test-yaml-new:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -350,12 +385,12 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.1.0' EXPECTED_TAG: "v0.1.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file-new.yaml' version-file: "test-file-new.yaml"
version-path: 'package.version' version-path: "package.version"
- name: Show file - name: Show file
run: | run: |
@ -364,9 +399,9 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file-new.yaml' FILES: "test-file-new.yaml"
EXPECTED_VERSION: '0.1.0' EXPECTED_VERSION: "0.1.0"
EXPECTED_VERSION_PATH: 'package.version' EXPECTED_VERSION_PATH: "package.version"
test-yaml-empty: test-yaml-empty:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -386,12 +421,12 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.1.0' EXPECTED_TAG: "v0.1.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: './test-file-empty.yaml' version-file: "./test-file-empty.yaml"
version-path: 'package.version' version-path: "package.version"
- name: Show file - name: Show file
run: | run: |
@ -400,9 +435,9 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file-empty.yaml' FILES: "test-file-empty.yaml"
EXPECTED_VERSION: '0.1.0' EXPECTED_VERSION: "0.1.0"
EXPECTED_VERSION_PATH: 'package.version' EXPECTED_VERSION_PATH: "package.version"
test-toml: test-toml:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -422,12 +457,12 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.10.0' EXPECTED_TAG: "v0.10.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file.toml' version-file: "test-file.toml"
version-path: 'package.version' version-path: "package.version"
- name: Show file - name: Show file
run: | run: |
@ -436,9 +471,9 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file.toml' FILES: "test-file.toml"
EXPECTED_VERSION: '0.10.0' EXPECTED_VERSION: "0.10.0"
EXPECTED_VERSION_PATH: 'package.version' EXPECTED_VERSION_PATH: "package.version"
test-toml-new: test-toml-new:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -458,12 +493,12 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.1.0' EXPECTED_TAG: "v0.1.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file-new.toml' version-file: "test-file-new.toml"
version-path: 'package.version' version-path: "package.version"
- name: Show file - name: Show file
run: | run: |
@ -472,9 +507,9 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file-new.toml' FILES: "test-file-new.toml"
EXPECTED_VERSION: '0.1.0' EXPECTED_VERSION: "0.1.0"
EXPECTED_VERSION_PATH: 'package.version' EXPECTED_VERSION_PATH: "package.version"
test-toml-empty: test-toml-empty:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -496,13 +531,13 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v6.5.0' EXPECTED_TAG: "v6.5.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: './test-file-empty.toml' version-file: "./test-file-empty.toml"
version-path: 'package.version' version-path: "package.version"
fallback-version: '6.5.0' fallback-version: "6.5.0"
- name: Show file - name: Show file
run: | run: |
@ -511,9 +546,9 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file-empty.toml' FILES: "test-file-empty.toml"
EXPECTED_VERSION: '6.5.0' EXPECTED_VERSION: "6.5.0"
EXPECTED_VERSION_PATH: 'package.version' EXPECTED_VERSION_PATH: "package.version"
test-pre-commit: test-pre-commit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -535,13 +570,13 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v1.5.0' EXPECTED_TAG: "v1.5.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
pre-commit: './test-pre-commit.js' pre-commit: "./test-pre-commit.js"
skip-on-empty: 'false' skip-on-empty: "false"
version-file: './test-file.json' version-file: "./test-file.json"
- run: test -f pre-commit.test.json || (echo should be here && exit 1) - run: test -f pre-commit.test.json || (echo should be here && exit 1)
- run: cat pre-commit.test.json && echo "" - run: cat pre-commit.test.json && echo ""
@ -567,13 +602,13 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v1.0.100-alpha' EXPECTED_TAG: "v1.0.100-alpha"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
pre-changelog-generation: './test-pre-changelog-generation.js' pre-changelog-generation: "./test-pre-changelog-generation.js"
version-file: './test-file.toml' version-file: "./test-file.toml"
version-path: 'package.version' version-path: "package.version"
- run: test -f pre-changelog-generation.version.test.json || (echo should be here && exit 1) - run: test -f pre-changelog-generation.version.test.json || (echo should be here && exit 1)
- run: test -f pre-changelog-generation.tag.test.json || (echo should be here && exit 1) - run: test -f pre-changelog-generation.tag.test.json || (echo should be here && exit 1)
@ -599,11 +634,11 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v1.5.0' EXPECTED_TAG: "v1.5.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file.json, test-file-2.json, test-file.toml, test-file.yaml' version-file: "test-file.json, test-file-2.json, test-file.toml, test-file.yaml"
- name: Show files - name: Show files
run: | run: |
@ -619,8 +654,8 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file.json, test-file-2.json, test-file.toml, test-file.yaml' FILES: "test-file.json, test-file-2.json, test-file.toml, test-file.yaml"
EXPECTED_VERSION: '1.5.0, 1.5.0, 1.5.0, 1.11.0' EXPECTED_VERSION: "1.5.0, 1.5.0, 1.5.0, 1.11.0"
test-config-file-path: test-config-file-path:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -640,12 +675,12 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v0.1.0' EXPECTED_TAG: "v0.1.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
skip-version-file: 'true' skip-version-file: "true"
config-file-path: './test-changelog.config.js' config-file-path: "./test-changelog.config.js"
- name: Test output - name: Test output
run: | run: |
@ -655,7 +690,6 @@ jobs:
echo "Changelog config not applied" && exit 1 echo "Changelog config not applied" && exit 1
fi fi
test-skip-ci: test-skip-ci:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -674,13 +708,13 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v1.5.0' EXPECTED_TAG: "v1.5.0"
SKIP_CI: 'false' SKIP_CI: "false"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file.json' version-file: "test-file.json"
skip-ci: 'false' skip-ci: "false"
- name: Show file - name: Show file
run: | run: |
@ -689,8 +723,8 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file.json' FILES: "test-file.json"
EXPECTED_VERSION: '1.5.0' EXPECTED_VERSION: "1.5.0"
test-pre-release: test-pre-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -710,11 +744,11 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v1.4.6-rc.0' EXPECTED_TAG: "v1.4.6-rc.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file.json' version-file: "test-file.json"
pre-release: true pre-release: true
- name: Show file - name: Show file
@ -724,8 +758,8 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file.json' FILES: "test-file.json"
EXPECTED_VERSION: '1.4.6-rc.0' EXPECTED_VERSION: "1.4.6-rc.0"
test-pre-release-identifier: test-pre-release-identifier:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -745,13 +779,13 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v1.4.6-alpha.0' EXPECTED_TAG: "v1.4.6-alpha.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file.json' version-file: "test-file.json"
pre-release: true pre-release: true
pre-release-identifier: 'alpha' pre-release-identifier: "alpha"
- name: Show file - name: Show file
run: | run: |
@ -760,8 +794,8 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file.json' FILES: "test-file.json"
EXPECTED_VERSION: '1.4.6-alpha.0' EXPECTED_VERSION: "1.4.6-alpha.0"
test-pre-release-to-stable: test-pre-release-to-stable:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -781,11 +815,11 @@ jobs:
id: changelog id: changelog
uses: ./ uses: ./
env: env:
ENV: 'dont-use-git' ENV: "dont-use-git"
EXPECTED_TAG: 'v1.5.0' EXPECTED_TAG: "v1.5.0"
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: 'test-file-pre-release.json' version-file: "test-file-pre-release.json"
pre-release: false # This is the default value, but we want to be explicit pre-release: false # This is the default value, but we want to be explicit
- name: Show file - name: Show file
@ -795,5 +829,5 @@ jobs:
- name: Test output - name: Test output
run: node ./test-output.js run: node ./test-output.js
env: env:
FILES: 'test-file-pre-release.json' FILES: "test-file-pre-release.json"
EXPECTED_VERSION: '1.5.0' EXPECTED_VERSION: "1.5.0"

View File

@ -24,7 +24,7 @@ This action will bump version, tag commit and generate a changelog with conventi
- **Optional** `skip-version-file`: Do not update the version file. Default `'false'`. - **Optional** `skip-version-file`: Do not update the version file. Default `'false'`.
- **Optional** `skip-commit`: Do not create a release commit. Default `'false'`. - **Optional** `skip-commit`: Do not create a release commit. Default `'false'`.
- **Optional** `pre-commit`: Path to the pre-commit script file. No hook by default. - **Optional** `pre-commit`: Path to the pre-commit script file. No hook by default.
- **Optional** `fallback-version`: The fallback version, if no older one can be detected, or if it is the first one. Default `'0.1.0'` - **Optional** `fallback-version`: The fallback version, if no older one can be detected, or if it is the first one. Default `'0.1.0'`. If `pre-release`is set to `true` it will default to the configured pre-release format (i.e. `'0.1.0-rc.0'`)
- **Optional** `config-file-path`: Path to the conventional changelog config file. If set, the preset setting will be ignored - **Optional** `config-file-path`: Path to the conventional changelog config file. If set, the preset setting will be ignored
- **Optional** `pre-changelog-generation`: Path to the pre-changelog-generation script file. No hook by default. - **Optional** `pre-changelog-generation`: Path to the pre-changelog-generation script file. No hook by default.
- **Optional** `skip-ci`: Adds instruction to Github to not consider the push something to rebuild. Default `true`. - **Optional** `skip-ci`: Adds instruction to Github to not consider the push something to rebuild. Default `true`.

View File

@ -1,156 +1,155 @@
name: 'Conventional Changelog Action' name: "Conventional Changelog Action"
description: 'Bump version, tag commit and generates changelog with conventional commits.' description: "Bump version, tag commit and generates changelog with conventional commits."
author: 'Tycho Bokdam' author: "Tycho Bokdam"
runs: runs:
using: 'node16' using: "node16"
main: 'src/index.js' main: "src/index.js"
branding: branding:
icon: 'edit' icon: "edit"
color: 'red' color: "red"
inputs: inputs:
github-token: github-token:
description: 'Github token' description: "Github token"
default: ${{ github.token }} default: ${{ github.token }}
required: false required: false
git-message: git-message:
description: 'Commit message to use' description: "Commit message to use"
default: 'chore(release): {version}' default: "chore(release): {version}"
required: false required: false
git-user-name: git-user-name:
description: 'The git user.name to use for the commit' description: "The git user.name to use for the commit"
default: 'Conventional Changelog Action' default: "Conventional Changelog Action"
required: false required: false
git-user-email: git-user-email:
description: 'The git user.email to use for the commit' description: "The git user.email to use for the commit"
default: 'conventional.changelog.action@github.com' default: "conventional.changelog.action@github.com"
required: false required: false
git-pull-method: git-pull-method:
description: 'The git pull method used when pulling all changes from remote' description: "The git pull method used when pulling all changes from remote"
default: '--ff-only' default: "--ff-only"
required: false required: false
git-push: git-push:
description: 'Should all the git changes be push' description: "Should all the git changes be push"
default: 'true' default: "true"
required: false required: false
git-branch: git-branch:
description: 'The git branch to be pushed' description: "The git branch to be pushed"
default: ${{ github.ref }} default: ${{ github.ref }}
required: false required: false
preset: preset:
description: 'The preset from Conventional Changelog to use' description: "The preset from Conventional Changelog to use"
default: 'angular' default: "angular"
required: false required: false
tag-prefix: tag-prefix:
description: 'Prefix that is used for the git tag' description: "Prefix that is used for the git tag"
default: 'v' default: "v"
required: false required: false
output-file: output-file:
description: 'File to output the changelog to' description: "File to output the changelog to"
default: 'CHANGELOG.md' default: "CHANGELOG.md"
required: false required: false
release-count: release-count:
description: 'Number of releases to preserve in changelog' description: "Number of releases to preserve in changelog"
default: '5' default: "5"
required: false required: false
version-file: version-file:
description: 'The path to the file that contains the version to bump (supports comma-separated list of file paths)' description: "The path to the file that contains the version to bump (supports comma-separated list of file paths)"
default: './package.json' default: "./package.json"
required: false required: false
version-path: version-path:
description: 'The place inside the version file to bump' description: "The place inside the version file to bump"
default: 'version' default: "version"
required: false required: false
skip-git-pull: skip-git-pull:
description: 'Do not pull the repo before tagging. Ensure you full cloned the repo in the first place to get tags' description: "Do not pull the repo before tagging. Ensure you full cloned the repo in the first place to get tags"
default: 'false' default: "false"
required: false required: false
skip-on-empty: skip-on-empty:
description: 'Do nothing when the changelog from the latest release is empty' description: "Do nothing when the changelog from the latest release is empty"
default: 'true' default: "true"
required: false required: false
skip-version-file: skip-version-file:
description: 'Do not update the version file' description: "Do not update the version file"
default: 'false' default: "false"
required: false required: false
skip-commit: skip-commit:
description: 'Do create a release commit' description: "Do create a release commit"
default: 'false' default: "false"
required: false required: false
pre-commit: pre-commit:
description: 'Path to the pre-commit script file' description: "Path to the pre-commit script file"
required: false required: false
fallback-version: fallback-version:
description: 'The fallback version, if no older one can be detected, or if it is the first one' description: "The fallback version, if no older one can be detected, or if it is the first one"
default: '0.1.0'
required: false required: false
config-file-path: config-file-path:
description: 'Path to the conventional changelog config file. If set, the preset setting will be ignored' description: "Path to the conventional changelog config file. If set, the preset setting will be ignored"
required: false required: false
pre-changelog-generation: pre-changelog-generation:
description: 'Path to the pre-changelog-generation script file' description: "Path to the pre-changelog-generation script file"
required: false required: false
git-url: git-url:
description: 'Git Url' description: "Git Url"
default: 'github.com' default: "github.com"
required: false required: false
git-path: git-path:
description: 'Path filter for the logs. If set, only commits that match the path filter will be considered' description: "Path filter for the logs. If set, only commits that match the path filter will be considered"
default: '' default: ""
required: false required: false
skip-ci: skip-ci:
description: 'Adds [skip ci] to commit message, to avoid triggering a new build' description: "Adds [skip ci] to commit message, to avoid triggering a new build"
default: 'true' default: "true"
required: false required: false
create-summary: create-summary:
description: 'Adds the generated changelog as Action Summary' description: "Adds the generated changelog as Action Summary"
default: 'false' default: "false"
required: false required: false
pre-release: pre-release:
description: 'Marks the release as pre-release' description: "Marks the release as pre-release"
default: 'false' default: "false"
required: false required: false
pre-release-identifier: pre-release-identifier:
description: 'The identifier to use for pre-releases' description: "The identifier to use for pre-releases"
default: 'rc' default: "rc"
required: false required: false
outputs: outputs:
changelog: changelog:
description: 'The generated changelog for the new version' description: "The generated changelog for the new version"
clean_changelog: clean_changelog:
description: 'The generated changelog for the new version without the version name in it' description: "The generated changelog for the new version without the version name in it"
version: version:
description: 'The new version' description: "The new version"
tag: tag:
description: 'The name of the generated tag' description: "The name of the generated tag"
skipped: skipped:
description: 'boolean to check if this step have been skipped' description: "boolean to check if this step have been skipped"

View File

@ -19,13 +19,16 @@ module.exports = async (releaseType, version) => {
if (version) { if (version) {
newVersion = semver.inc(version, (prerelease ? 'prerelease' : releaseType), identifier) newVersion = semver.inc(version, (prerelease ? 'prerelease' : releaseType), identifier)
} else { } else {
let version = semver.valid(core.getInput('fallback-version'))
if (version) { const fallbackVersion = core.getInput('fallback-version')
newVersion = version
} else { if (fallbackVersion) {
newVersion = semver.valid(fallbackVersion)
}
if (!newVersion) {
// default // default
newVersion = '0.1.0' newVersion = (prerelease ? `0.1.0-${identifier}.0` : '0.1.0')
} }
core.info(`The version could not be detected, using fallback version '${newVersion}'.`) core.info(`The version could not be detected, using fallback version '${newVersion}'.`)