Skip to content

Commit bd3da0e

Browse files
authored
feat: update root package-lock after workspace releases (#125)
1 parent f6aa844 commit bd3da0e

File tree

2 files changed

+71
-2
lines changed

2 files changed

+71
-2
lines changed

lib/content/release-please.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
- {{.}}
1212
{{/each}}
1313

14+
{{~#if isWorkspace}}
15+
permissions:
16+
contents: write
17+
{{/if}}
18+
1419
jobs:
1520
release-please:
1621
runs-on: ubuntu-latest
@@ -32,3 +37,19 @@ jobs:
3237
{{{json .}}}{{#unless @last}},{{/unless}}
3338
{{/each}}
3439
]
40+
{{~#if isWorkspace}}
41+
{{> setupGit}}
42+
{{> setupNode}}
43+
- name: Update package-lock.json and commit
44+
if: steps.release.outputs.pr
45+
env:
46+
GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
gh pr checkout $\{{ fromJSON(steps.release.outputs.pr).number }}
49+
npm run resetdeps
50+
title="$\{{ fromJSON(steps.release.outputs.pr).title }}"
51+
# get the version from the pr title
52+
# get everything after the last space
53+
git commit -am "deps: {{pkgName}}@${title##* }"
54+
git push
55+
{{/if}}

tap-snapshots/test/apply/full-content.js.test.cjs

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,8 @@ on:
10561056
branches:
10571057
- main
10581058
- latest
1059+
permissions:
1060+
contents: write
10591061
10601062
jobs:
10611063
release-please:
@@ -1077,7 +1079,29 @@ jobs:
10771079
{"type":"docs","section":"Documentation","hidden":false},
10781080
{"type":"deps","section":"Dependencies","hidden":false},
10791081
{"type":"chore","hidden":true}
1080-
]
1082+
] - uses: actions/checkout@v3
1083+
- name: Setup git user
1084+
run: |
1085+
git config --global user.email "[email protected]"
1086+
git config --global user.name "npm cli ops bot"
1087+
- uses: actions/setup-node@v3
1088+
with:
1089+
node-version: 16.x
1090+
- name: Update npm to latest
1091+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
1092+
- run: npm -v
1093+
- name: Update package-lock.json and commit
1094+
if: steps.release.outputs.pr
1095+
env:
1096+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
1097+
run: |
1098+
gh pr checkout \${{ fromJSON(steps.release.outputs.pr).number }}
1099+
npm run resetdeps
1100+
title="\${{ fromJSON(steps.release.outputs.pr).title }}"
1101+
# get the version from the pr title
1102+
# get everything after the last space
1103+
git commit -am "deps: bbb@\${title##* }"
1104+
git push
10811105
10821106
.github/workflows/release-please-name-aaaa.yml
10831107
========================================
@@ -1092,6 +1116,8 @@ on:
10921116
branches:
10931117
- main
10941118
- latest
1119+
permissions:
1120+
contents: write
10951121
10961122
jobs:
10971123
release-please:
@@ -1113,7 +1139,29 @@ jobs:
11131139
{"type":"docs","section":"Documentation","hidden":false},
11141140
{"type":"deps","section":"Dependencies","hidden":false},
11151141
{"type":"chore","hidden":true}
1116-
]
1142+
] - uses: actions/checkout@v3
1143+
- name: Setup git user
1144+
run: |
1145+
git config --global user.email "[email protected]"
1146+
git config --global user.name "npm cli ops bot"
1147+
- uses: actions/setup-node@v3
1148+
with:
1149+
node-version: 16.x
1150+
- name: Update npm to latest
1151+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
1152+
- run: npm -v
1153+
- name: Update package-lock.json and commit
1154+
if: steps.release.outputs.pr
1155+
env:
1156+
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
1157+
run: |
1158+
gh pr checkout \${{ fromJSON(steps.release.outputs.pr).number }}
1159+
npm run resetdeps
1160+
title="\${{ fromJSON(steps.release.outputs.pr).title }}"
1161+
# get the version from the pr title
1162+
# get everything after the last space
1163+
git commit -am "deps: @name/aaaa@\${title##* }"
1164+
git push
11171165
11181166
.github/workflows/release-please.yml
11191167
========================================

0 commit comments

Comments
 (0)