-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnullplatform-asset-lambda-push.yml
74 lines (72 loc) · 2.23 KB
/
nullplatform-asset-lambda-push.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
spec:
inputs:
ci-image:
ci-before-script:
command:
default: make
arguments:
default: build
options:
default: ""
build-working-directory:
default: .
asset-working-directory:
default: .
asset-output-directory:
default: build
asset-name:
default: main
---
stages:
- nullplatform-asset-lambda-push
variables:
RUNNER_TAG: $RUNNER_TAG
NULLPLATFORM_API_KEY: $NULLPLATFORM_API_KEY
NULLPLATFORM_ENCRIPTION_KEY: $NULLPLATFORM_ENCRIPTION_KEY
nullplatform-asset-lambda-push:
image: $[[ inputs.ci-image ]]
stage: nullplatform-asset-lambda-push
before_script:
- $[[ inputs.ci-before-script ]]
script:
- |+
# Sanitize function
sanitize_path() {
local path="$1"
# Remove "./" from the beginning of the path, but preserve "."
if [ "$path" != "./" ]; then
path="${path#./}"
fi
# Remove trailing slashes
path="${path%/}"
echo "$path"
}
# Sanitize paths
build_working_directory=$(sanitize_path "$[[ inputs.build-working-directory ]]")
asset_working_directory=$(sanitize_path "$[[ inputs.asset-working-directory ]]")
asset_output_directory=$(sanitize_path "$[[ inputs.asset-output-directory ]]")
- openssl enc -d -iter 1000 -aes-256-cbc -in assets-to-create.txt.enc -out assets-to-create.txt -k "$NULLPLATFORM_ENCRIPTION_KEY"
- |+
#push
BUILD_WORKING_DIRECTORY=$build_working_directory
ASSET_WORKING_DIRECTORY=$asset_working_directory
ASSET_OUTPUT_DIRECTORY="$asset_working_directory/$asset_output_directory"
ASSET_NAME=$[[ inputs.asset-name ]]
ASSET_TYPE=lambda
make_file_path="$build_working_directory"
make_file_task="push"
while IFS= read -r line; do
for env_var in $line
do
export "$env_var"
done
make -C $make_file_path $make_file_task \
BUILD_WORKING_DIRECTORY=$BUILD_WORKING_DIRECTORY \
ASSET_WORKING_DIRECTORY=$ASSET_WORKING_DIRECTORY \
ASSET_OUTPUT_DIRECTORY=$ASSET_OUTPUT_DIRECTORY \
ASSET_NAME=$ASSET_NAME \
ASSET_TYPE=$ASSET_TYPE \
ASSET_TARGET_URL=$ASSET_URL
done < assets-to-create.txt
except:
- tags