diff --git a/.github/action/bump-npm-version/action.yml b/.github/action/bump-npm-version/action.yml new file mode 100644 index 00000000..80997004 --- /dev/null +++ b/.github/action/bump-npm-version/action.yml @@ -0,0 +1,38 @@ +name: Bump NPM Version + + +inputs: + bump: + description: 'Which version bump (patch, minor, major)' + required: true + default: 'patch' + type: choice + options: + - patch + - minor + - major + +jobs: + bump: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Configure Git + run: | + git config user.name 'celobot' + git config user.email 'github-celobot@celonis.com' + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} + + - name: Run npm version + run: | + npm install + npm version ${{ inputs.bump }} -m "chore: bump version to %s" + git push origin HEAD + git push origin --tags diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index f3988125..cd4df093 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -1,13 +1,29 @@ -name: Build and publish Workflow +name: Build and Publish Workflow on: - push: - branches: [ master ] - paths-ignore: - - 'package.json' - - '.github/**' + workflow_dispatch: + inputs: + bump: + description: 'Which version bump (patch, minor, major)' + required: true + default: 'patch' + type: choice + options: + - patch + - minor + - major + jobs: + version-bump: + runs-on: ubuntu-latest + steps: + - name: Bump NPM version + uses: ./.github/action/bump-npm-version + with: + bump: ${{ inputs.bump }} + build: + needs: version-bump runs-on: ubuntu-latest name: Npm install and npm build