Add leo clone and publish for circleci

This commit is contained in:
howardwu 2021-02-25 09:34:06 -08:00
parent 4fc5f3f30c
commit dd4ee7dd9a
3 changed files with 61 additions and 1 deletions

View File

@ -138,6 +138,32 @@ jobs:
export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/leo-login-logout.sh
leo-clone:
docker:
- image: cimg/rust:1.50.0
resource_class: xlarge
steps:
- attach_workspace:
at: /home/circleci/project/
- run:
name: leo clone
command: |
export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/leo-clone.sh
leo-publish:
docker:
- image: cimg/rust:1.50.0
resource_class: xlarge
steps:
- attach_workspace:
at: /home/circleci/project/
- run:
name: leo publish
command: |
export LEO=/home/circleci/project/project/bin/leo
./project/.circleci/leo-publish.sh
workflows:
version: 2
main-workflow:
@ -160,4 +186,7 @@ workflows:
- rust-stable
- leo-login-logout:
requires:
- rust-stable
- rust-stable
- leo-publish:
requires:
- rust-stable

16
.circleci/leo-clone.sh Executable file
View File

@ -0,0 +1,16 @@
# leo clone
$LEO clone leobot/test-app
# Assert that the 'test-app' folder is not empty
cd test-app || exit 1
if [ "$(ls -A $DIR)" ]; then
echo "$DIR is not empty"
else
echo "$DIR is empty"
exit 1
fi
ls -la
$LEO run

View File

@ -1,4 +1,19 @@
# leo login, publish and logout
$LEO new test-app && cd test-app
$LEO login -u "ALEO_PM_USERNAME" -p "ALEO_PM_PASSWORD"
# sed command below takes 0.1.0 version (which is default for new programs)
# and replaces it with GITHUB_RUN_ID - a unique incremental number for each
# GH Actions run; [AUTHOR] gets replaced with $USER variable; and we're ready
# to publish package with newer version and correct author
cat Leo.toml | sed "s/0.1.0/0.1.$GITHUB_RUN_ID/g" | sed "s/\[AUTHOR\]/$USER/g" > Leo.toml
$LEO publish
$LEO logout
mkdir hello-world && cd hello-world || exit 1
$LEO init
ls -la
$LEO run