Make Version #50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Make Version | |
on: | |
workflow_dispatch: | |
inputs: | |
release-type: | |
description: 'Release type (major, minor, patch)' | |
required: false | |
permissions: | |
contents: read | |
jobs: | |
bump-version: | |
permissions: | |
id-token: write | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
env: | |
NODE_VERSION: "22" | |
outputs: | |
RELEASE_VERSION: ${{ steps.version-n-changelog.outputs.new-version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 # fetch all history, commits and tags, so we can determine the next version | |
- name: Setup Node.js | |
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: "npm" | |
- name: Setup dependencies | |
uses: aws-powertools/actions/.github/actions/cached-node-modules@7d2401cbbb232594bde7285bc5b8c0c78dcbe6e2 # v1.2.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@7d2401cbbb232594bde7285bc5b8c0c78dcbe6e2 # v1.2.0 | |
with: | |
release-type: ${{ github.event.inputs.release-type }} | |
- name: Update user agent version | |
run: | | |
VERSION=$(${{ steps.version-n-changelog.outputs.new-version }}) | |
echo -e "// this file is auto generated, do not modify\nexport const PT_VERSION = '$VERSION';" > packages/commons/src/version.ts | |
- name: Stage changes | |
run: git add . | |
- name: Create PR | |
id: create-pr | |
uses: aws-powertools/actions/.github/actions/create-pr@7d2401cbbb232594bde7285bc5b8c0c78dcbe6e2 # v1.2.0 | |
with: | |
temp_branch_prefix: "ci-bump" | |
pull_request_title: "chore(ci): bump version to ${{ steps.version-n-changelog.outputs.new-version }}" | |
github_token: ${{ secrets.GITHUB_TOKEN }} |