Bump Version #4
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: Bump Version | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version number' | |
required: true | |
jobs: | |
# Validate Repository Configuration | |
config: | |
runs-on: ubuntu-latest | |
outputs: | |
config_package: ${{ steps.config_package.outputs.configPackage }} | |
steps: | |
# Ensure that required repository variable has been created for the Package | |
- name: Validate Package Config | |
id: config_package | |
run: | | |
if [ "${{ vars.PACKAGE_NAME }}" != "" ]; then | |
echo "configPackage=true" >> $GITHUB_OUTPUT; | |
else | |
echo "configPackage=false" >> $GITHUB_OUTPUT; | |
fi | |
# Build and release the Package | |
# If the repository is not configured properly, this job will be skipped | |
build: | |
needs: config | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
#pull-requests: write | |
env: | |
packagePath: Packages/${{ vars.PACKAGE_NAME }} | |
if: needs.config.outputs.config_package == 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
fetch-depth: 0 | |
#token: ${{ secrets.TOKEN }} | |
- name: Update package.json | |
uses: jossef/action-set-json-field@890d7642122dbb2833dddd2003659bb71a2b21fe | |
with: | |
file: ${{ env.packagePath }}/package.json | |
field: version | |
value: ${{ github.event.inputs.version }} | |
- name: Commit changes | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -am "Bump version to ${{ github.event.inputs.version }}" | |
git tag -a ${{ github.event.inputs.version }} -m "Version ${{ github.event.inputs.version }}" | |
- name: Push changes | |
uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa | |
with: | |
github_token: ${{ secrets.TOKEN }} | |
tags: true |