name: Make Version
on:
workflow_dispatch:
inputs:
release-type:
description: "Release type (major, minor, patch)"
required: false
type: choice
options:
- major
- minor
- patch
permissions:
contents: read
jobs:
bump-version:
permissions:
id-token: write
contents: write
pull-requests: write
runs-on: ubuntu-latest
outputs:
RELEASE_VERSION: ${{ steps.set-release-version.outputs.RELEASE_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ github.ref }}
fetch-depth: 0 # fetch all history, commits and tags, lerna scans it to the last tag and looks at commits, we need all of it to determine the next version
- name: Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: "24"
cache: "npm"
- name: Setup dependencies
uses: aws-powertools/actions/.github/actions/cached-node-modules@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # v1.5.0
with:
node-version: ${{ env.NODE_VERSION }}
build: "false"
- name: Version and changelog
id: version-n-changelog
uses: aws-powertools/actions/.github/actions/version-n-changelog@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # v1.5.0
with:
release-type: ${{ github.event.inputs.release-type }}
- name: Update user agent version
run: |
echo -e "// this file is auto generated, do not modify\nexport const VERSION = '${{ steps.version-n-changelog.outputs.new-version }}';" > src/version.ts
- name: Stage changes
run: git add .
- name: Set release version
id: set-release-version
run: |
VERSION=$(cat package.json | jq .version -r)
echo RELEASE_VERSION="$VERSION" >> "$GITHUB_OUTPUT"
- name: Create PR
id: create-pr
uses: aws-powertools/actions/.github/actions/create-pr@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # v1.5.0
with:
temp_branch_prefix: "ci-bump"
pull_request_title: "chore: bump version to ${{ steps.set-release-version.outputs.RELEASE_VERSION }}"
github_token: ${{ secrets.GITHUB_TOKEN }}