-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RND-649] Add lerna version update process into GitHub Action #320
Changes from all commits
57bd905
5cbc796
feccee4
1803174
7dba18d
8cfbdac
fbaf1b4
fd77612
4a944fc
48fb2a2
5525b74
78a81b4
5957b11
4f02301
2d0a63b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,10 @@ on: | |
- ".github/**" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: abcdefgh1! | ||
|
@@ -112,6 +116,49 @@ jobs: | |
- name: Linter | ||
run: npm run test:lint | ||
|
||
upgrade: | ||
# Upgrade packages on PR only to avoid a double update when pushed to main | ||
name: Upgrade packages | ||
if: github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: Meadowlark-js | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout the Repo | ||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | ||
with: | ||
fetch-depth: 0w | ||
|
||
- name: Get changes | ||
id: changes | ||
run: | | ||
suggested=v$(cat lerna.json | jq -r .version) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To check whether or not we need to add a new commit for the new version, we compare the value in lerna.json against the latest tag available, if it's different, we assume that a change has already be done as part of this PR. warning this means that manually updating the lerna.json version (not recommended) will cause the update not to run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bradbanister FYI |
||
current=$(git describe --tags $(git rev-list --tags --max-count=1)) | ||
echo "changes=$([[ "$suggested" != "$current" ]] && echo true)" >>$GITHUB_OUTPUT | ||
|
||
- name: Update versions | ||
if: ${{ ! steps.changes.outputs.changes }} | ||
run: npx [email protected] version prerelease --exact --no-git-tag-version --yes | ||
|
||
- name: Set Version | ||
if: ${{ ! steps.changes.outputs.changes }} | ||
id: set-version | ||
run: | | ||
version=v$(cat lerna.json | jq -r .version) | ||
echo "version=$version" >> "$GITHUB_OUTPUT" | ||
|
||
- uses: planetscale/ghcommit-action@4131649dbf2fdf1eb34421702972a5af7b0a8731 #v0.1.18 | ||
if: ${{ ! steps.changes.outputs.changes }} | ||
with: | ||
commit_message: "${{steps.set-version.outputs.version}}" | ||
repo: ${{ github.repository }} | ||
branch: ${{ github.head_ref || github.ref_name }} | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
build: | ||
name: Build | ||
needs: lint | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,7 @@ | |
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "v0.3.0-pre-35", | ||
"version": "0.4.0-pre.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This update had to be done manually for the first version, this will be done automatically in future changes |
||
"npmClient": "npm", | ||
"useWorkspaces": true, | ||
"command": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could potentially allow users to create tags with lerna from branches, but this is currently possible from git tags also |
||
"version": { | ||
"allowBranch": "main" | ||
} | ||
} | ||
"useWorkspaces": true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍