Restrict cds version 7 #141
Workflow file for this run
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: Version bump | |
on: | |
pull_request: | |
types: [opened, labeled] | |
permissions: | |
contents: write | |
pull-requests: read | |
jobs: | |
# This will enforce pull request to have a label 'patch', 'minor', 'major', 'norelease' | |
enforce-label-version-release: | |
name: 'Enforce Labels: patch, minor, major, norelease' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Enforce version release labels | |
uses: yogevbd/enforce-label-action@2.2.2 | |
with: | |
REQUIRED_LABELS_ANY: 'patch,minor,major,norelease' | |
REQUIRED_LABELS_ANY_DESCRIPTION: "Select at least one label ['patch', 'minor', 'major', 'norelease']" | |
if-label-norelease-stop: | |
name: No bump version if label 'norelease' | |
needs: enforce-label-version-release | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'norelease') }} | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo The PR has can be have bump increase | |
# This will use the enforced label from the previous step to increase the package.json version | |
bump-version: | |
needs: [if-label-norelease-stop, enforce-label-version-release] | |
name: 'Bump: version increase' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: 'Save version to .env' | |
env: | |
IS_PATCH_FOUND: ${{ contains(github.event.pull_request.labels.*.name, 'patch') }} | |
IS_MINOR_FOUND: ${{ contains(github.event.pull_request.labels.*.name, 'minor') }} | |
IS_MAJOR_FOUND: ${{ contains(github.event.pull_request.labels.*.name, 'major') }} | |
run: | | |
if [ "${IS_MINOR_FOUND}" == "true" ]; then | |
echo "version=minor" >> $GITHUB_ENV | |
echo "Version: minor" | |
elif [ "${IS_PATCH_FOUND}" == "true" ]; then | |
echo "version=patch" >> $GITHUB_ENV | |
echo "Version: patch" | |
elif [ "${IS_MAJOR_FOUND}" == "true" ]; then | |
echo "version=major" >> $GITHUB_ENV | |
echo "Version: major" | |
else | |
echo "version=norelease" >> $GITHUB_ENV | |
echo "Version: norelease" | |
fi | |
- name: 'Automated: version bump (package.json)' | |
id: version-bump | |
uses: phips28/gh-action-bump-version@v11.0.0 | |
with: | |
version-type: ${{ env.version }} | |
minor-wording: minor | |
major-wording: major | |
patch-wording: patch | |
skip-tag: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |