-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.yml
141 lines (132 loc) · 4.97 KB
/
action.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: 'Publish to NeoFS'
description: 'This action allows you to publish files, tests reports, static web pages and etc. to NeoFS'
author: 'Neo SPCC'
branding:
icon: 'server'
color: 'green'
inputs:
NEOFS_WALLET:
description: Base64-encoded NEP-6 Neo N3 wallet for NeoFS network access. See the README.md for more information
required: true
NEOFS_WALLET_PASSWORD:
description: N3 wallet password
required: true
NEOFS_NETWORK_DOMAIN:
description: Rpc endpoint domain address
required: false
default: 'st1.storage.fs.neo.org'
NEOFS_HTTP_GATE:
description: REST gateway domain address
required: false
default: 'rest.fs.neo.org'
STORE_OBJECTS_CID:
description: Container ID for your data
required: true
PATH_TO_FILES_DIR:
description: Path to the directory with the files to be pushed
required: true
NEOFS_ATTRIBUTES:
description: User attributes in form of Key1=Value1,Key2=Value2
required: false
URL_PREFIX:
description: Prefix to the url address for each of the files(objects)
required: false
LIFETIME:
description: Number of epochs for object to stay valid
required: false
default: 0
STRIP_PREFIX:
description: Drop PATH_TO_FILES_DIR from uploaded data, treat it as the root of container
required: false
default: 'False'
REPLACE_OBJECTS:
description: Replace existing objects with the same attributes in the container
required: false
default: 'True'
REPLACE_CONTAINER_CONTENTS:
description: Remove all the old existing objects in the container after the new objects are uploaded
required: false
default: 'False'
outputs:
OUTPUT_CONTAINER_URL:
description: Container URL
value: ${{ steps.put_files.outputs.container_url }}
runs:
using: composite
steps:
- name: Download latest stable neofs-cli for uploading reports to NeoFS for Linux
uses: dsaltares/fetch-gh-release-asset@1.1.1
if: runner.os == 'Linux'
with:
repo: 'nspcc-dev/neofs-node'
version: 'tags/v0.41.1'
file: 'neofs-cli-linux-amd64'
target: 'neofs/neofs-cli'
- name: Download latest stable neofs-cli for uploading reports to NeoFS for macOS
uses: dsaltares/fetch-gh-release-asset@1.1.1
if: runner.os == 'macOS'
with:
repo: 'nspcc-dev/neofs-node'
version: 'tags/v0.41.1'
file: 'neofs-cli-darwin-arm64'
target: 'neofs/neofs-cli'
- name: Chmod latest stable neofs-cli
shell: bash
run: |
sudo chmod a+x neofs-cli
working-directory: neofs
- name: Enable stable neofs-cli
shell: bash
run: |
echo "$(pwd)" >> $GITHUB_PATH
working-directory: neofs
- name: Create wallet
shell: bash
env:
NEOFS_WALLET: ${{ inputs.NEOFS_WALLET }}
GITHUB_ACTION_PATH: ${{ github.action_path }}
run: |
echo "$NEOFS_WALLET" | base64 -d > "$GITHUB_ACTION_PATH/wallet.json"
- name: Install required package if running on macos
shell: bash
if: runner.os == 'macOS'
run: |
brew install libmagic
- name: Prepare venv
shell: bash
id: prepare_venv
env:
GITHUB_ACTION_PATH: ${{ github.action_path }}
run: |
python3 -m venv "$GITHUB_ACTION_PATH/venv"
source "$GITHUB_ACTION_PATH/venv/bin/activate" && pip install -r "$GITHUB_ACTION_PATH/requirements.txt"
- name: Put files to NeoFS
shell: bash
id: put_files
env:
NEOFS_WALLET_PASSWORD: ${{ inputs.NEOFS_WALLET_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ inputs.NEOFS_NETWORK_DOMAIN }}
STORE_OBJECTS_CID: ${{ inputs.STORE_OBJECTS_CID }}
NEOFS_HTTP_GATE: ${{ inputs.NEOFS_HTTP_GATE }}
PATH_TO_FILES_DIR: ${{ inputs.PATH_TO_FILES_DIR }}
NEOFS_ATTRIBUTES: ${{ inputs.NEOFS_ATTRIBUTES }}
URL_PREFIX: ${{ inputs.URL_PREFIX }}
LIFETIME: ${{ inputs.LIFETIME }}
STRIP_PREFIX: ${{ inputs.STRIP_PREFIX }}
REPLACE_OBJECTS: ${{ inputs.REPLACE_OBJECTS }}
REPLACE_CONTAINER_CONTENTS: ${{ inputs.REPLACE_CONTAINER_CONTENTS }}
GITHUB_ACTION_PATH: ${{ github.action_path }}
run: |
source "$GITHUB_ACTION_PATH/venv/bin/activate" && NEOFS_CLI_PASSWORD=$NEOFS_WALLET_PASSWORD python "$GITHUB_ACTION_PATH/push-to-neofs.py" \
--lifetime "$LIFETIME" --neofs_domain "$NEOFS_NETWORK_DOMAIN" --attributes "$NEOFS_ATTRIBUTES" \
--cid "$STORE_OBJECTS_CID" --files-dir "$PATH_TO_FILES_DIR" --url_path_prefix "$URL_PREFIX" \
--replace-objects "$REPLACE_OBJECTS" --replace-container-contents "$REPLACE_CONTAINER_CONTENTS" \
--strip-prefix "$STRIP_PREFIX" --wallet "$GITHUB_ACTION_PATH/wallet.json"
BASE_URL="https://$NEOFS_HTTP_GATE/$STORE_OBJECTS_CID"
if [ -z "$URL_PREFIX" ]; then
echo "container_url=$BASE_URL/" >> $GITHUB_OUTPUT
echo "$BASE_URL/"
else
echo "container_url=$BASE_URL/$URL_PREFIX/" >> $GITHUB_OUTPUT
echo "$BASE_URL/$URL_PREFIX/"
fi