Skip to content

Commit 8b0f51b

Browse files
authored
chore(releases): automatically update the lockfile in changeset PRs (#2732)
This is a step which we currently need to do manually and it's rather painful. The lockfile update is necessary due to cross references in our packages. Added it as a separate job instead of a step to start from fresh workspace, as the state that the `changeset` step leaves the workdir is not explicitly clear to the reader.
1 parent 331882f commit 8b0f51b

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ jobs:
8282
package_version=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[0].version')
8383
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
8484
85+
# this triggers the publish workflow for the docker images
86+
- name: 🏷️ Create and push docker tag
87+
if: steps.changesets.outputs.published == 'true'
88+
run: |
89+
set -e
90+
git tag "v.docker.${{ steps.get_version.outputs.package_version }}"
91+
git push origin "v.docker.${{ steps.get_version.outputs.package_version }}"
92+
8593
- name: Update PR title with version
8694
if: steps.changesets.outputs.published != 'true'
8795
env:
@@ -94,3 +102,42 @@ jobs:
94102
VERSION=$(git show origin/changeset-release/main:packages/cli-v3/package.json | jq -r '.version')
95103
gh pr edit "$PR_NUMBER" --title "chore: release v$VERSION"
96104
fi
105+
106+
update-lockfile:
107+
name: Update lockfile on release PR
108+
runs-on: ubuntu-latest
109+
needs: release
110+
if: needs.release.outputs.published != 'true'
111+
permissions:
112+
contents: write
113+
steps:
114+
- name: Checkout release branch
115+
uses: actions/checkout@v4
116+
with:
117+
ref: changeset-release/main
118+
119+
- name: Setup pnpm
120+
uses: pnpm/action-setup@v4
121+
with:
122+
version: 10.23.0
123+
124+
- name: Setup node
125+
uses: buildjet/setup-node@v4
126+
with:
127+
node-version: 20.19.0
128+
129+
- name: Install and update lockfile
130+
run: pnpm install
131+
132+
- name: Commit and push lockfile
133+
run: |
134+
set -e
135+
if git diff --quiet pnpm-lock.yaml; then
136+
echo "No lockfile changes"
137+
else
138+
git config user.name "github-actions[bot]"
139+
git config user.email "github-actions[bot]@users.noreply.github.com"
140+
git add pnpm-lock.yaml
141+
git commit -m "chore: update lockfile for release"
142+
git push origin changeset-release/main
143+
fi

0 commit comments

Comments
 (0)