I manage my automatic release and deployment processes with Github actions.
In my yml file, things increase by npm version and according to the label in the pull request, respectively. Make a new commit and do the deployment process and complete the actions.
My problem here is my version number in the development branch, for example, I am updating the 1.2.3 patch version. It becomes 1.2.4 and reflects on the development branch, but when deploying, it sends version 1.2.3. How can i solve this problem.
An example from my yml file
name: development deploy
on:
pull_request:
types:
- closed
branches:
- development
push:
branches:
- development
jobs:
automatic-version-update:
name: Automatic version update
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Check Out Repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16.15'
- name: Update Version
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
PR_LABELS=$(jq --raw-output '.pull_request.labels[].name' $GITHUB_EVENT_PATH)
if [[ $PR_LABELS == *"minor version"* ]]; then
npm version minor -m "Updated to minor version %s"
elif [[ $PR_LABELS == *"major version"* ]]; then
npm version major -m "Updated to major version %s"
elif [[ $PR_LABELS == *"patch version"* ]]; then
npm version patch -m "Updated to patch version %s"
fi
- name: Push Changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.event.pull_request.base.ref }}
build-deploy:
needs: automatic-version-update
name: Deployment jobs
runs-on: ubuntu-latest
steps:
- name: Check Out Repository
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: '16.15'
- name: Install packages
run: yarn install
- name: React build
run: yarn run build:dev
- name: Deploy to Server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
SOURCE: '.'
REMOTE_HOST: ${{ secrets.SERVER_HOST }}
REMOTE_USER: ${{ secrets.SERVER_USERNAME }}
TARGET: ${{ secrets.SERVER_ROOT_FOLDER }}