chore: Update the markdown example for clarity #13
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: | |
pull_request: | |
branches: | |
- v2 | |
types: | |
- closed | |
jobs: | |
bump-version: | |
name: Bump version depending on labels | |
runs-on: ubuntu-latest | |
if: | | |
github.event.pull_request.merged == true && ( | |
contains(github.event.pull_request.labels.*.name, 'patch') || | |
contains(github.event.pull_request.labels.*.name, 'minor') ) | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
- name: Bump version | |
run: | | |
IFS=',' read -r -a label_array <<< "${{ join(github.event.pull_request.labels.*.name, ',') }}" | |
if [[ "${label_array[*]}" =~ "minor" ]]; then | |
yarn version --minor --no-git-tag-version | |
elif [[ "${label_array[*]}" =~ "patch" ]]; then | |
yarn version --patch --no-git-tag-version | |
else | |
echo "No version bump needed" | |
fi | |
- name: Install dependencies | |
run: yarn | |
- name: Generate builds | |
run: yarn build | |
- name: Get the new version | |
id: get_version | |
run: echo "::set-output name=version::$(node -p "require('./package.json').version")" | |
- name: Commit and push changes | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add package.json dist/ | |
git commit -m "Bump version to ${{ steps.get_version.outputs.version }}" | |
git push origin HEAD:v2 |