Skip to content

Commit 4e66045

Browse files
committed
refactoring CI
1 parent 2b4066a commit 4e66045

File tree

8 files changed

+62
-70
lines changed

8 files changed

+62
-70
lines changed

.github/conan-remotes/Dockerfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/conan-remotes/entrypoint.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/conan-upload/Dockerfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/conan-upload/entrypoint.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/cpt/entrypoint.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
#!/bin/sh -l
22

3+
34
eval "$(pyenv init -)"
45
eval "$(pyenv virtualenv-init -)"
6+
7+
8+
# fixing issue with conan_package_tools and python_requires
59
if [ x != "x$CONAN_UPLOAD" ]; then
610
conan remote add upload_repo $CONAN_UPLOAD
711
fi
12+
13+
i=1
14+
old_ifs=$IFS
15+
IFS=,
16+
for r in $CONAN_REMOTES; do
17+
conan remote add env_remote_$i "$r"
18+
i=$(($i+1))
19+
done
20+
IFS=$old_ifs
21+
22+
823
python build.py

.github/main.workflow

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
1-
workflow "CI" {
1+
workflow "Publish" {
22
on = "push"
33
resolves = "publish"
44
}
55

6-
7-
action "remotes" {
8-
uses = "./.github/conan-remotes/"
9-
env = {
10-
CONAN_REMOTES = "https://api.bintray.com/conan/bincrafters/public-conan"
11-
CONAN_UPLOAD = "https://api.bintray.com/conan/grisumbras/conan"
12-
}
6+
action "publish" {
7+
needs = ["filter-publish", "store-env"]
8+
uses = "./.github/cpt/"
9+
secrets = ["CONAN_LOGIN_USERNAME", "CONAN_PASSWORD"]
1310
}
1411

1512

13+
workflow "Build" {
14+
on = "push"
15+
resolves = "build"
16+
}
17+
1618
action "build" {
17-
needs = "remotes"
19+
needs = ["filter-not-publish", "store-env"]
1820
uses = "./.github/cpt/"
21+
}
22+
23+
24+
action "filter-publish" {
25+
uses = "actions/bin/filter@master"
26+
args = "branch master || tag"
27+
}
28+
29+
30+
action "filter-not-publish" {
31+
uses = "actions/bin/filter@master"
32+
args = "not branch master && not tag"
33+
}
34+
35+
36+
action "store-env" {
37+
uses = "./.github/store-env/"
1938
env = {
2039
CONAN_CHANNEL = "testing"
2140
CONAN_STABLE_BRANCH_PATTERN = "\\d+\\.\\d+(\\.\\d+[-\\w\\.]*)?"
@@ -25,16 +44,3 @@ action "build" {
2544
CONAN_USERNAME = "grisumbras"
2645
}
2746
}
28-
29-
30-
action "filter-ref" {
31-
needs = "build"
32-
uses = "actions/bin/filter@master"
33-
args = "branch master || tag"
34-
}
35-
36-
action "publish" {
37-
uses = "./.github/conan-upload/"
38-
needs = "filter-ref"
39-
secrets = ["CONAN_LOGIN_USERNAME", "CONAN_PASSWORD"]
40-
}

.github/store-env/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM alpine AS base
2+
3+
LABEL "com.github.actions.name"="store-env"
4+
LABEL "com.github.actions.description"="Stores environment variables in .profile"
5+
LABEL "description"="Stores environment variables in .profile"
6+
LABEL "maintainer"="Dmitry Arkhipov <grisumbras@gmail.com>"
7+
8+
USER root
9+
ADD entrypoint.sh /entrypoint.sh
10+
ENTRYPOINT ["/entrypoint.sh"]

.github/store-env/entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh -l
2+
3+
for e in $(env); do
4+
k=$(echo $e | cut -d= -f1)
5+
v=$(echo $e | sed 's/^.*=//')
6+
if [ "x$k" = "x${k#GITHUB_}" ]; then
7+
echo "export $k='$v'" >>~/.profile
8+
fi
9+
done

0 commit comments

Comments
 (0)