Update CircleCI config with release tag builds
This commit is contained in:
@@ -1,17 +1,72 @@
|
|||||||
version: 2.1
|
version: 2.1
|
||||||
commands:
|
workflows:
|
||||||
calculate-tag-name:
|
# Defines jobs to run when a commit is pushed to master branch
|
||||||
description: "Calculates the target tag name for Docker image"
|
build-latest-version:
|
||||||
parameters:
|
jobs:
|
||||||
distro:
|
- build-armhf-image:
|
||||||
type: string
|
context: dockerhub
|
||||||
steps:
|
filters:
|
||||||
- run:
|
branches:
|
||||||
name: Calculate tag to set for the built Docker image
|
only:
|
||||||
command: |
|
- master
|
||||||
if [ "$CIRCLE_BRANCH" = "master" ]; then TAG_VERSION=latest; else TAG_VERSION=$CIRCLE_BRANCH; fi
|
- build-arm64-image:
|
||||||
if [ "<< parameters.distro >>" = "ubuntu" ]; then TAG_DISTRO=""; else TAG_DISTRO=-<< parameters.distro >>; fi
|
context: dockerhub
|
||||||
echo "export IMAGE_TAG=$TAG_VERSION$TAG_DISTRO" >> $BASH_ENV
|
filters:
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- build-and-deploy-gh-pages:
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: master
|
||||||
|
|
||||||
|
# Defines jobs to run when a commit is pushed to dev branch
|
||||||
|
build-dev-version:
|
||||||
|
jobs:
|
||||||
|
- build-armhf-image:
|
||||||
|
context: dockerhub
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- dev
|
||||||
|
- build-arm64-image:
|
||||||
|
context: dockerhub
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- dev
|
||||||
|
|
||||||
|
# Defines jobs to run when a new release tag is created
|
||||||
|
build-tagged-version:
|
||||||
|
jobs:
|
||||||
|
- build-ubuntu-image:
|
||||||
|
context: dockerhub
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
||||||
|
tags:
|
||||||
|
only: /^\d+\.\d+.*/
|
||||||
|
- build-alpine-image:
|
||||||
|
context: dockerhub
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
||||||
|
tags:
|
||||||
|
only: /^\d+\.\d+.*/
|
||||||
|
- build-armhf-image:
|
||||||
|
context: dockerhub
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
||||||
|
tags:
|
||||||
|
only: /^\d+\.\d+.*/
|
||||||
|
- build-arm64-image:
|
||||||
|
context: dockerhub
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
||||||
|
tags:
|
||||||
|
only: /^\d+\.\d+.*/
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-ubuntu-image:
|
build-ubuntu-image:
|
||||||
@@ -34,6 +89,26 @@ jobs:
|
|||||||
name: Push image
|
name: Push image
|
||||||
command: docker push $IMAGE_NAME:$IMAGE_TAG
|
command: docker push $IMAGE_NAME:$IMAGE_TAG
|
||||||
|
|
||||||
|
build-alpine-image:
|
||||||
|
environment:
|
||||||
|
IMAGE_NAME: haugene/transmission-openvpn
|
||||||
|
docker:
|
||||||
|
- image: circleci/buildpack-deps:stretch
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- setup_remote_docker
|
||||||
|
- calculate-tag-name:
|
||||||
|
distro: alpine
|
||||||
|
- run:
|
||||||
|
name: Build Docker image
|
||||||
|
command: docker build -t $IMAGE_NAME:$IMAGE_TAG -f Dockerfile.alpine .
|
||||||
|
- run:
|
||||||
|
name: Login to Docker Hub
|
||||||
|
command: echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||||
|
- run:
|
||||||
|
name: Push image
|
||||||
|
command: docker push $IMAGE_NAME:$IMAGE_TAG
|
||||||
|
|
||||||
build-armhf-image:
|
build-armhf-image:
|
||||||
environment:
|
environment:
|
||||||
IMAGE_NAME: haugene/transmission-openvpn
|
IMAGE_NAME: haugene/transmission-openvpn
|
||||||
@@ -98,33 +173,28 @@ jobs:
|
|||||||
name: "Build and push site"
|
name: "Build and push site"
|
||||||
command: mkdocs gh-deploy --message "Deployed {sha} with MkDocs version {version}. [skip ci]"
|
command: mkdocs gh-deploy --message "Deployed {sha} with MkDocs version {version}. [skip ci]"
|
||||||
|
|
||||||
workflows:
|
commands:
|
||||||
version: 2
|
calculate-tag-name:
|
||||||
build-images:
|
description: "Calculates the target tag name for Docker image"
|
||||||
jobs:
|
parameters:
|
||||||
- build-ubuntu-image:
|
distro:
|
||||||
context: dockerhub
|
type: string
|
||||||
filters:
|
steps:
|
||||||
branches:
|
- run:
|
||||||
only:
|
name: Calculate tag to set for the built Docker image
|
||||||
- beta
|
command: |
|
||||||
- build-armhf-image:
|
if [ ! -z $CIRCLE_TAG ]; then
|
||||||
context: dockerhub
|
TAG_VERSION=$CIRCLE_TAG
|
||||||
filters:
|
elif [ "$CIRCLE_BRANCH" = "master" ]; then
|
||||||
branches:
|
TAG_VERSION=latest
|
||||||
only:
|
else
|
||||||
- master
|
TAG_VERSION=$CIRCLE_BRANCH;
|
||||||
- dev
|
fi
|
||||||
- build-arm64-image:
|
|
||||||
context: dockerhub
|
if [ "<< parameters.distro >>" = "ubuntu" ]; then
|
||||||
filters:
|
TAG_DISTRO="";
|
||||||
branches:
|
else
|
||||||
only:
|
TAG_DISTRO=-<< parameters.distro >>;
|
||||||
- master
|
fi
|
||||||
- dev
|
|
||||||
documentation-update:
|
echo "export IMAGE_TAG=$TAG_VERSION$TAG_DISTRO" >> $BASH_ENV
|
||||||
jobs:
|
|
||||||
- build-and-deploy-gh-pages:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only: master
|
|
||||||
|
Reference in New Issue
Block a user