Skip to content

Commit

Permalink
add npm package
Browse files Browse the repository at this point in the history
  • Loading branch information
untitaker committed Jun 25, 2022
1 parent 5d8f8a2 commit 6c3d9d6
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 14 deletions.
16 changes: 2 additions & 14 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,9 @@ runs:
run: |
set -x
cd ${{ github.action_path }}
tag="$(grep '^version = ' Cargo.toml | head -1 | cut -d '"' -f2)"
if [ "$RUNNER_OS" == "Linux" ]; then
curl -L -o bin https://github.com/untitaker/hyperlink/releases/download/$tag/hyperlink-linux-x86_64
elif [ "$RUNNER_OS" == "Windows" ]; then
curl -L -o bin https://github.com/untitaker/hyperlink/releases/download/$tag/hyperlink-windows-x86_64.exe
elif [ "$RUNNER_OS" = "MacOS" ]; then
curl - L -o bin https://github.com/untitaker/hyperlink/releases/download/$tag/hyperlink-mac-x86_64
else
echo "$RUNNER_OS not supported"
exit 1
fi
chmod +x bin
sh scripts/install.sh
shell: bash

- name: Run Hyperlink
run: ${{ github.action_path }}/bin ${{ inputs.args }} --github-actions
run: ${{ github.action_path }}/hyperlink ${{ inputs.args }} --github-actions
shell: bash
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@untitaker/hyperlink",
"description": "Very fast link checker for CI.",
"license": "MIT",
"version": "0.1.22",
"bin": {
"hyperlink": "scripts/hyperlink-bin"
},
"scripts": {
"install": "scripts/install.sh"
},
"files": ["scripts/install.sh", "scripts/hyperlink-bin"]
}
4 changes: 4 additions & 0 deletions scripts/hyperlink-bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
# install.sh is supposed to overwrite this file during installation
echo "npm/yarn did not run postinstall script correctly. please run script/install.sh manually."
exit 1
21 changes: 21 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
UNAME=$(uname)
tag="$(grep '"version":' ./package.json | cut -d'"' -f4)"
echo "downloading hyperlink $tag for $UNAME"
case $UNAME in
Linux) (
curl -L -o scripts/hyperlink-bin https://github.com/untitaker/hyperlink/releases/download/$tag/hyperlink-linux-x86_64
) ;;
Darwin) (
curl -L -o scripts/hyperlink-bin https://github.com/untitaker/hyperlink/releases/download/$tag/hyperlink-mac-x86_64
) ;;
CYGWIN*) (
curl -L -o scripts/hyperlink-bin https://github.com/untitaker/hyperlink/releases/download/$tag/hyperlink-windows-x86_64.exe
) ;;
*) (
echo "$UNAME not supported"
exit 1
)
esac

chmod +x scripts/hyperlink-bin
3 changes: 3 additions & 0 deletions scripts/release-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ sed -i.bak "s/$action_prefix$current_version/$action_prefix$new_version/" README
rm README.md.bak
sed -i.bak "s/version = \"$current_version\"/version = \"$new_version\"/" Cargo.toml
rm Cargo.toml.bak
sed -i.bak "s/\"version\": \"$current_version\"/\"version\": \"$new_version\"/" package.json
rm package.json.bak

echo ">>> Running tests"
cargo build
Expand All @@ -36,6 +38,7 @@ set +x

echo "things left to do:"
echo " cargo publish"
echo " npm publish"
echo " git push"
echo " git push origin $new_version"
echo " uncheck and check 'Publish to Marketplace' property of the new release"
Expand Down

0 comments on commit 6c3d9d6

Please sign in to comment.