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

feat: automate homebrew-tap #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omidasadpour
Copy link

This PR configures npm-package-updater workflow to automate the updating process of sunodo cli NPM package.

The workflow uses repository_dispatch and this workflow calls from sunodo/sunodo repository , the cli.yaml workflow.

@omidasadpour omidasadpour self-assigned this Dec 19, 2023
PACKAGE_NAME="@sunodo/cli"
PACKAGE_VERSION=$(npm show $PACKAGE_NAME version)
PACKAGE_URL=$(npm show $PACKAGE_NAME dist.tarball)
PACKAGE_SHA256=$(npm show $PACKAGE_NAME dist.shasum | awk '{print $1}')
Copy link
Contributor

Choose a reason for hiding this comment

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

dist.shasum is not a sha256

Copy link
Author

@omidasadpour omidasadpour Jan 15, 2024

Choose a reason for hiding this comment

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

I sent a Fixup.

@omidasadpour omidasadpour requested a review from tuler January 15, 2024 09:36
@omidasadpour omidasadpour force-pushed the feat/automate-homebrew-tap branch from f122e33 to 4e4ec8d Compare January 15, 2024 09:37
Comment on lines 33 to 57
PACKAGE_NAME="@sunodo/cli"
PACKAGE_VERSION=$(npm show $PACKAGE_NAME version)
PACKAGE_URL=$(npm show $PACKAGE_NAME dist.tarball)
npm pack @sunodo/cli@$PACKAGE_VERSION
PACKAGE_SHA256=$(sha256sum sunodo-cli-$PACKAGE_VERSION.tgz | awk '{print $1}')

if [ -z "$PACKAGE_VERSION" ] || [ -z "$PACKAGE_URL" ] || [ -z "$PACKAGE_SHA256" ]; then
echo "Failed to retrieve package information. Exiting..."
exit 1
fi

echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo "PACKAGE_URL=$PACKAGE_URL" >> $GITHUB_ENV
echo "PACKAGE_SHA256=$PACKAGE_SHA256" >> $GITHUB_ENV
Copy link
Contributor

Choose a reason for hiding this comment

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

Although the hash is the way to check for integrity, defining the hash for the package should come from the package that's already published since this step could have problems during download and we could add the wrong hash.

So, we should use the npm view @sunodo/cli dist.integrity that's a bse64 encoded SHA512.

So the Formula/sunodo.rb should use sha512 instead.

Copy link
Contributor

@endersonmaia endersonmaia Jan 15, 2024

Choose a reason for hiding this comment

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

Note: I'm not sure if homebrew Formula supports sha512. Have to check.

Copy link
Contributor

Choose a reason for hiding this comment

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

In case homebrew only supports sha256 we should check the download against sha512 before running sha256 to change the sunodo.rb Formula.

Copy link
Author

Choose a reason for hiding this comment

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

It looks, it does not support.
Homebrew/legacy-homebrew#38945

@omidasadpour omidasadpour force-pushed the feat/automate-homebrew-tap branch from bd22adb to f4a208d Compare January 29, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants