Hi guys,
We are currently using a lerna monorepo for our microservices and semantic-release to automatically version bump and create changelogs. We now want to auto deploy after the semantic-release process runs in each changed service during a PR merge to develop
, staging
, or master
branches. What is the best way to go about doing this?
1 Like
rophilogene
(Romaric Philogene)
July 22, 2022, 6:43pm
2
Hi @itajenglish ,
Do you already have a CI like GitHub Actions, GitLab CI, Circle CI… in place or not yet?
@rophilogene We are using Github Actions.
This is what our current release script looks like
name: Create new release
on:
push:
branches: [ master, develop, staging ]
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 'lts/*'
- name: Authenticate with GitHub package registry
run: |
echo "//npm.pkg.github.com/:_authToken=$NPM_TOKEN" > .npmrc
echo '@listedb:registry=https://npm.pkg.github.com' >> .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
- name: Release
run: yarn run release-packages
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
rophilogene
(Romaric Philogene)
July 24, 2022, 3:58pm
4
Hi @itajenglish ,
Did you take a look at this guide ?
It is quite complete but let me know if something is missing, I will complete here
@rophilogene I have. Didn’t see an example on how to integrate it in a monorepo. I might have to try to do some custom scripting.
rophilogene
(Romaric Philogene)
July 24, 2022, 7:34pm
6
@itajenglish , you can take a look at our web console v3 repository - we are using GitHub Actions + Qovery to deploy on staging and production when the pipeline is all green. We also use the Qovery Preview Environments when a new PR is created.
For each application in your monorepo, you can add a GitHub Action workflow and then control which app should be redeployed based on what happened in your CI pipeline.
I can make a tutorial for that
@rophilogene That would be really helpful. Thank you!
1 Like