-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.yml
95 lines (95 loc) · 3.12 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
# ########################################################################
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ########################################################################
# action.yml
name: "Addon Factory UCC Framework package generator"
description: "Produce splunk package"
inputs:
version:
description: Version stamp for output
required: true
outputs:
OUTPUT:
description: "Package produced from the build"
value: ${{ steps.output.outputs.result }}
runs:
using: "composite"
steps:
- shell: bash
run: |
if [ -f "Pipfile.lock" ]
then
mkdir -p package/lib || true
pip install pipenv
pipenv lock -r > package/lib/requirements.txt
pipenv lock -d -r > requirements_dev.txt
fi
- shell: bash
run: |
if [ -f "poetry.lock" ]
then
pip install poetry==1.5.1 poetry-plugin-export==1.4.0
poetry export --without-hashes -o requirements.txt
if [ "$(grep -cve '^\s*$' requirements.txt)" -ne 0 ]
then
echo "Prod dependencies were found, creating package/lib folder"
mkdir -p package/lib || true
mv requirements.txt package/lib
else
echo "No prod dependencies were found"
rm requirements.txt
fi
poetry export --without-hashes --dev -o requirements_dev.txt
if [ ! -z $INPUT_VERSION ]
then
poetry version $INPUT_VERSION
fi
fi
- shell: bash
run: pip install -r requirements_dev.txt
- run: |
if [ ! -z $INPUT_VERSION ]; then ARG_VERSION="--ta-version=${INPUT_VERSION}"; fi
echo "result=$(echo $ARG_VERSION)" >> $GITHUB_OUTPUT
echo running ucc-gen $ARG_VERSION
ucc-gen $ARG_VERSION
shell: bash
env:
INPUT_VERSION: ${{ inputs.version }}
- run: |
if [ -f package.json ]
then
yarn
if [ ! -z $INPUT_VERSION ]
then
yarn version --new-version $INPUT_VERSION --no-git-tag-version
fi
yarn run build
fi
shell: bash
- run: chmod -R +r output
shell: bash
- run: chmod -R go-w output
shell: bash
- id: output
shell: bash
run: |
OUTPUT=output/$(ls output/)
SOURCE_REGEX='^.*/$'
if [[ $OUTPUT =~ $SOURCE_REGEX ]];
then
echo Removing trailing / from OUTPUT slim is picky
OUTPUT=$(echo $OUTPUT | sed 's/\(.*\)\//\1/')
fi
echo "result=$(echo $OUTPUT)" >> $GITHUB_OUTPUT