mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
34 lines
1.3 KiB
YAML
34 lines
1.3 KiB
YAML
version: 2
|
|
jobs:
|
|
build:
|
|
docker:
|
|
- image: circleci/golang:1.11.0
|
|
working_directory: ~/fdk-go
|
|
steps:
|
|
- checkout
|
|
- setup_remote_docker:
|
|
docker_layer_caching: true
|
|
- run: docker version
|
|
- run: docker pull fnproject/fnserver
|
|
# installing Fn CLI and starting the Fn server
|
|
- run:
|
|
command: |
|
|
curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh
|
|
- run:
|
|
command: fn build
|
|
working_directory: examples/hello
|
|
- deploy:
|
|
command: |
|
|
if [[ "${CIRCLE_BRANCH}" == "master" && -z "${CIRCLE_PR_REPONAME}" ]]; then
|
|
func_version=$(awk '/^version:/ { print $2; }' func.yaml)
|
|
printenv DOCKER_PASS | docker login -u ${DOCKER_USER} --password-stdin
|
|
git config --global user.email "ci@fnproject.com"
|
|
git config --global user.name "CI"
|
|
git branch --set-upstream-to=origin/${CIRCLE_BRANCH} ${CIRCLE_BRANCH}
|
|
docker tag "hello:${func_version}" "fnproject/fdk-go-hello:${func_version}"
|
|
docker tag "hello:${func_version}" "fnproject/fdk-go-hello:latest"
|
|
docker push "fnproject/fdk-go-hello:${func_version}"
|
|
docker push "fnproject/fdk-go-hello:latest"
|
|
fi
|
|
working_directory: examples/hello
|