-
-
Notifications
You must be signed in to change notification settings - Fork 23
138 lines (130 loc) · 4.5 KB
/
Package.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
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
---
name: Package
on: push
jobs:
Package_For_PIP:
strategy:
matrix:
platform: [ubuntu-latest]
python: ['3.x']
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: "Echo Vars"
run: |
echo matrix.platform: ${{ matrix.platform }}
echo matrix.python: ${{ matrix.python }}
- name: Git fetch
run: git fetch --prune --unshallow
- name: Get Branch Name
run: |
branchname=$(git rev-parse --abbrev-ref HEAD)
echo "branchname=$branchname" >> "$GITHUB_ENV"
- name: Get Current Release Tag
run: |
currrelease=$(git describe --abbrev=0 --tags)
echo "currrelease=$currrelease" >> "$GITHUB_ENV"
- name: Determine if this is a release branch
run: |
isrrelease=0
if [[ $branchname =~ v[0-9]\. ]]; then
isrrelease=1
fi
echo "isrrelease=$isrrelease" >> "$GITHUB_ENV"
- name: Determine if this is master branch
run: |
ismaster=0
if [[ $branchname == master ]]; then
ismaster=1
fi
echo "ismaster=$ismaster" >> "$GITHUB_ENV"
- name: Get Date String
if: ${{ env.isrrelease == 0 && env.ismaster == 0 }}
run: |
datestr=$(date +%Y%m%d%H%M%S)
echo "datestr=$datestr" >> "$GITHUB_ENV"
- name: Set Version Number to Branch Name
if: ${{ env.isrrelease == 1 }}
run: |
numver=$(echo "$branchname" | sed -E 's/v([^-]*)/\1/')
echo "numver=$numver" >> "$GITHUB_ENV"
version=v$numver
echo "version=$version" >> "$GITHUB_ENV"
- name: Set New Version Number
if: ${{ env.isrrelease == 0 && env.ismaster == 0 }}
run: |
numver=$(echo "$currrelease" | sed -E 's/v([^-]*)/\1/')
mapfile -d . -t numverparts < <(echo "$numver")
len=${#numverparts[@]}
if [ "$len" -gt "2" ]; then
numver=${numverparts[0]}.${numverparts[1]}.$(( numverparts[2] + 1))
elif [ "$len" -eq "2" ]; then
numver=${numverparts[0]}.${numverparts[1]}.1
else
numver=${numverparts[0]}.0.1
fi
numver=$numver.dev$datestr
echo "numver=$numver" >> "$GITHUB_ENV"
version=v$numver
echo "version=$version" >> "$GITHUB_ENV"
- name: "Echo Vars 2"
run: |
echo numver: ${{ env.numver }}
echo version: ${{ env.version }}
- name: Update Version Number in python files
run: |
pwd
ls -la
# echo "get files"
files=$(find . -name 'rfswarm*.py')
for file in $files
do
# echo "version variable : $file"
sed -i -e "s/version = \"[^\"]*\"/version = \"${version}\"/" "$file"
sed -i -e "s/version=\"[^\"]*\"/version = \"${version}\"/" "$file"
# echo "version comment : $file"
sed -i -e "s/# Version .*/# Version ${version}/" "$file"
done
files=$(find . -name 'setup-*.py')
for file in $files
do
# echo "version variable : $file"
sed -i -e "s/version = \"[^\"]*\"/version=\"${version}\"/" "$file"
sed -i -e "s/version=\"[^\"]*\"/version=\"${version}\"/" "$file"
# echo "version comment : $file"
# sed -i -e "s/# Version .*/# Version ${version}/" "$file"
done
# echo "--------------- head rfswarm_agent.py ---------------"
# head -50 rfswarm_agent/rfswarm_agent.py
echo "--------------- head setup-manager.py ---------------"
head -10 setup-manager.py
echo "--------------- end head setup-manager.py ---------------"
- name: Clear Dist
run: |
rm -fR dist/
- name: Clear Build for Manager
run: |
rm -fR build/
- name: Build Manager
run: |
python3 setup-manager.py sdist bdist_wheel
- name: Clear Build for Agent
run: |
rm -fR build/
- name: Build Agent
run: |
python3 setup-agent.py sdist bdist_wheel
- name: Clear Build for Reporter
run: |
rm -fR build/
- name: Build Reporter
run: |
python3 setup-reporter.py sdist bdist_wheel
- name: Show Dist
run: |
ls -la dist
#