Skip to content

Commit

Permalink
feat: version controll & docs
Browse files Browse the repository at this point in the history
  • Loading branch information
huyikun.hyk committed Jan 17, 2024
1 parent 9430f29 commit 29035ff
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 14 deletions.
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# setup-s-aliyun
<p align="center">
<span><b><a href="./README.md">中文</a> | <a href="./README_en.md">English</a></b></span><br>
</p>

## 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.
基于阿里云函数计算的 Serverless-devs 安装。

## 使用示例
```yaml
steps:
- name: Checkout
Expand All @@ -18,4 +19,17 @@ steps:
access_key_id: ${{ secrets.ACCESS_KEYID }}
access_key_secret: ${{ secrets.ACCESS_KEYSECRET }}
access: default
version: v3.0.0
```
## 参数说明
| 字段 | 说明 | 类型 | 默认值 |
| ----- | -------- | ---- | ---|
| account_id | 必填,阿里云账号ID | string | - |
| access_key_id | 必填,阿里云AK | string | - |
| access_key_secret | 必填,阿里云SK | string | - |
| access | 非必填,密钥别名 | string | default |
| version | 非必填,安装版本 | v3.0.0 | v3.0.0 |
密钥相关说明详见 [Serverless-devs 文档](https://docs.serverless-devs.com/serverless-devs/default_provider_config#%E9%98%BF%E9%87%8C%E4%BA%91%E5%AF%86%E9%92%A5%E8%8E%B7%E5%8F%96)。
34 changes: 34 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# setup-s-aliyun
<p align="center">
<span><b><a href="./README.md">中文</a> | <a href="./README_en.md">English</a></b></span><br>
</p>

Setting up serverless-devs based on Aliyun Function Compute.

## Usage
```yaml
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- 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
version: v3.0.0
```
## Params
| Property | Description | Type | Default |
| ----- | -------- | ---- | ---|
| account_id | required,Aliyun account ID | string |-|
| access_key_id | required,Aliyun AK | string | - |
| access_key_secret | required,Aliyun SK | string | - |
| access | aceess alias | string | default |
| version | setup version | v3.0.0 | v3.0.0 |
More details about access config to [Serverless-devs docs](https://docs.serverless-devs.com/serverless-devs/default_provider_config#%E9%98%BF%E9%87%8C%E4%BA%91%E5%AF%86%E9%92%A5%E8%8E%B7%E5%8F%96).
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ inputs:
description: 'Access Alias Name'
required: true
default: 'default'
version:
description: 'Serverless-devs Version, v3.0.0 as default.'
required: false
default: 'v3.0.0'

runs:
using: "composite"
steps:
- run: ./script.sh ${{ inputs.account_id }} ${{ inputs.access_key_id }} ${{ inputs.access_key_secret }} ${{ inputs.access }}
- run: ./script.sh ${{ inputs.account_id }} ${{ inputs.access_key_id }} ${{ inputs.access_key_secret }} ${{ inputs.access }} ${{ inputs.version }}
shell: bash
25 changes: 17 additions & 8 deletions script.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
set -e # 报错后不继续执行
echo 'Serverless-devs installing.'
curl https://images.devsapp.cn/bin/s/v3.0.0 --output /usr/local/bin/s
chmod 777 /usr/local/bin/s
echo '################################################'
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.'
version=$5
valid_version=(
v3.0.0
)
if [[ "${valid_version[@]}" =~ "${version}" ]]; then
echo 'Serverless-devs installing.'
echo "https://images.devsapp.cn/bin/s/${version}"
curl "https://images.devsapp.cn/bin/s/${version}" --output /usr/local/bin/s
chmod 777 /usr/local/bin/s
echo '################################################'
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.'
else
echo $version "is not valid, please choose correct version."
fi

0 comments on commit 29035ff

Please sign in to comment.