-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Serverless-Devs/v0.0.1
feat: V0.0.1
- Loading branch information
Showing
4 changed files
with
79 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
## Usage | ||
|
||
To include the action in a workflow in another repository, you can use the | ||
`uses` syntax with the `@` symbol to reference a specific branch, tag, or commit | ||
hash. | ||
|
||
```yaml | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
id: setupnode | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 14.14.0 | ||
|
||
- name: Setup Serverless-devs | ||
uses: actions/setup-s-aliyun@v1 | ||
with: | ||
account_id: ${{ secrets.ACCOUNT_ID }} | ||
access_key_id: ${{ secrets.ACCESS_KEYID }} | ||
access_key_secret: ${{ secrets.ACCESS_KEYSECRET }} | ||
access: default | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
set -e # 报错后不继续执行 | ||
LOCAL_VERSION=$(node -v) | ||
REQUIRED_VERSION='v14.14.0' | ||
echo 'Checking nodejs version, serverless-dev requires nodejs >= 14.14.0.' | ||
echo "Local nodejs's version is" $LOCAL_VERSION. | ||
function version_compare() { | ||
if [[ "$1" == "$2" ]]; then | ||
echo 0 # 本地版本等于要求版本 | ||
return | ||
fi | ||
if [[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" == "$1" ]]; then | ||
echo 1 # 本地版本小于要求版本 | ||
else | ||
echo 0 # 本地版本大于要求版本 | ||
fi | ||
} | ||
result=$(version_compare "$LOCAL_VERSION" "$REQUIRED_VERSION") | ||
if [ "$result" == 0 ]; then | ||
echo 'Nodejs checked, serverless-devs installing.' | ||
npm i @serverless-devs/s -g --registry=https://registry.npmmirror.com | ||
s config add --AccountID $1 --AccessKeyID $2 --AccessKeySecret $3 -a $4 -f | ||
echo '################################################' | ||
echo 'Serverless-devs has been installed successfully.' | ||
echo 'The access has been configured automatically, use "s config get" to check.' | ||
echo '################################################' | ||
else | ||
echo "Serverless-dev requires nodejs >= 14.14.0, please update your local nodejs's version." | ||
fi |