Merge pull request #1081 from novasamatech/rc/1.1.1-129 #130
This file contains 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: Create new tag | |
on: | |
push: | |
branches: | |
- 'main' | |
workflow_dispatch: | |
inputs: | |
component: | |
description: 'Version component to increment' | |
required: true | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
default: patch | |
jobs: | |
bump_package_verion: | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: WyriHaximus/github-action-get-previous-tag@v1 | |
- name: Bump version | |
id: bump | |
run: | | |
bash .github/bump_release_version.sh ${{ steps.previoustag.outputs.tag }} ${{ github.event.inputs.component }} | |
- name: Update package.json version | |
run: node scripts/updatePackageVersion.js ${{ steps.bump.outputs.major }}.${{ steps.bump.outputs.minor }}.${{ steps.bump.outputs.patch }} | |
- name: ➡️ Make pull request | |
uses: ./.github/workflows/make-pull-request | |
with: | |
commit_path: package.json | |
commit_message: 'ci: update version in package.json' | |
branch_name: rc/${{ steps.bump.outputs.major }}.${{ steps.bump.outputs.minor }}.${{ steps.bump.outputs.patch }} | |
destination_branch: main | |
second_destination_branch: dev | |
pr_title: Release candidate - ${{ steps.bump.outputs.major }}.${{ steps.bump.outputs.minor }}.${{ steps.bump.outputs.patch }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
create_new_tag: | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | |
token: ${{ secrets.CREATE_TAG_PAT }} | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: WyriHaximus/github-action-get-previous-tag@v1 | |
- name: Read package.json | |
run: | | |
echo "PACKAGE_JSON=$(jq -c . < package.json)" >> $GITHUB_ENV | |
- name: Put text version to env | |
run: | | |
echo "${{ fromJson(env.PACKAGE_JSON).version }}" | |
echo "PACKAGE_VERSION=${{ format('{0}{1}', 'v', fromJson(env.PACKAGE_JSON).version) }}" >> $GITHUB_ENV | |
- name: Create new tag | |
if: ${{ steps.previoustag.outputs.tag != env.PACKAGE_VERSION }} | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: v${{ fromJson(env.PACKAGE_JSON).version }} |