From 3bee0d38ba3be392d4118364ab13c5975bdbc2f3 Mon Sep 17 00:00:00 2001 From: Avram Walden Date: Mon, 9 Oct 2023 13:53:52 -0700 Subject: [PATCH] ci(release.yml): uses commitizen to bump version number --- .cz.toml | 3 +++ .github/workflows/release.yml | 38 +++++++++++------------------------ package.json | 2 +- 3 files changed, 16 insertions(+), 27 deletions(-) create mode 100644 .cz.toml diff --git a/.cz.toml b/.cz.toml new file mode 100644 index 000000000..02aafdbf3 --- /dev/null +++ b/.cz.toml @@ -0,0 +1,3 @@ +[tool.commitizen] +version = "0.1.0" +version_files = "package.json:3" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 901fe3d82..861d778cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,39 +1,25 @@ -name: Release +name: Bump version on: push: branches: - main -permissions: - contents: read # for checkout - jobs: - release: - name: Release - + bump_version: + if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }} runs-on: ubuntu-latest - - permissions: - contents: write # to be able to publish a GitHub release - issues: write # to be able to comment on released issues - pull-requests: write # to be able to comment on released pull requests - + name: "Bump version and create changelog with commitizen" steps: - - name: Checkout + - name: Check out uses: actions/checkout@v3 with: fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v3 + token: "${{ secrets.GITHUB_TOKEN }}" + - id: cz + name: Create bump and changelog + uses: commitizen-tools/commitizen-action@master with: - node-version: "lts/*" - - - name: Install dependencies - run: yarn install --frozen-lockfile - - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: yarn release + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Print Version + run: echo "Bumped to version ${{ steps.cz.outputs.version }}" diff --git a/package.json b/package.json index 5b6b34198..cbcd05cc5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "inventory", - "version": "0.0.0-development", + "version": "0.1.0", "main": "index.js", "repository": "https://github.com/aviemet/icr.git", "author": "Avram Walden ",