-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
54 lines (48 loc) · 1.62 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: 'Aliyun CLI Action'
description: 'Install and Configure Aliyun command line tool'
author: 'wadexu'
branding:
icon: 'cloud'
color: 'orange'
inputs:
version:
required: false
default: "3.0.161"
description: 'Aliyun CLI version'
mode:
default: "AK"
description: 'Aliyun CLI Authentication mode, invalid vaules are [AK|StsToken] here'
region:
required: true
description: 'Region name of your service, for example: cn-shanghai'
access-key-id:
required: true
description: 'Access key ID of your account'
access-key-secret:
required: true
description: 'Secret of the access key'
sts-token:
description: 'StsToken, required in StsToken mode'
runs:
using: composite
steps:
- run: |
#!/bin/bash
VERSION="${{ inputs.version }}"
if [[ ${VERSION} == "latest" ]]; then
VERSION=$(curl -sSL https://api.github.com/repos/aliyun/aliyun-cli/releases/latest | jq -r '.tag_name | split("/") | .[-1] | sub("^v"; "")')
fi
curl -sSL "https://github.com/aliyun/aliyun-cli/releases/download/v${VERSION}/aliyun-cli-linux-${VERSION}-amd64.tgz" | tar zxv
sudo install -m 755 aliyun /usr/local/bin/aliyun
rm -f aliyun
aliyun version
command="aliyun configure set \
--mode ${{ inputs.mode }} \
--region ${{ inputs.region }} \
--access-key-id ${{ inputs.access-key-id }} \
--access-key-secret ${{ inputs.access-key-secret }}"
if [ -n "${{ inputs.sts-token }}" ]; then
command="${command} --sts-token ${{ inputs.sts-token }}"
fi
$command
shell: bash