Skip to content
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

Implements signed releases #6490

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ jobs:
echo "yarnPath: '$TMPBIN/yarn.js'" >> .yarnrc.yml
git update-index --skip-worktree -- .yarnrc.yml

- name: 'Store the secrets'
run: |
printf "${{secrets.SIGN_PRIVATE_KEY}}" > /tmp/yarn.key
printf "${{secrets.SIGN_PUBLIC_KEY}}" > /tmp/yarn.pem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't store the public key as secret, it's a better idea to derive it from the private key – or store it in clear.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it as a secret to make clear both values were linked and needed to be updated should we need to change it (rather than hardcode it in a separate place), but true, it could be derived within the script itself 🤔


- name: 'Generate the release commits'
run: |
git config user.name "Yarn Bot"
Expand Down
2 changes: 2 additions & 0 deletions .yarn/versions/manual-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@yarnpkg/cli": patch
14 changes: 14 additions & 0 deletions scripts/release/01-release-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ yarn workspaces foreach \
--verbose --all --topological --no-private "${UPDATE_ARGUMENTS[@]}" \
run update-local

# Generate the signature
openssl dgst -sha256 -sign /tmp/yarn.key \
-out "$REPO_DIR"/packages/berry-cli/bin/berry.js.sign \
"$REPO_DIR"/packages/berry-cli/bin/berry.js

# Let's be sure the public & private keys are correctly setup
openssl dgst -sha256 -verify /tmp/yarn.pem \
-signature "$REPO_DIR"/packages/berry-cli/bin/berry.js.sign \
"$REPO_DIR"/packages/berry-cli/bin/berry.js

# We can copy the public key into the release folder
cp /tmp/yarn.pem \
"$REPO_DIR"/packages/berry-cli/bin/berry.pem

# The v1 still uses the "berry.js" file path when using "policies set-version"
cp "$REPO_DIR"/packages/yarnpkg-cli/bin/yarn.js \
"$REPO_DIR"/packages/berry-cli/bin/berry.js
Expand Down
Loading