version: 2.1 jobs: build: docker: - image: circleci/buildpack-deps:stretch steps: - checkout - deploy: name: Install build prerequisities command: | sudo apt-get update sudo apt-get install \ autoconf \ automake \ libmilter-dev \ pandoc - deploy: name: Configure command: | export AMAVISD_MILTER_VERSION="${CIRCLE_TAG}" sh autoconf.sh.in ./configure - deploy: name: Build command: | make all - deploy: name: Tarball command: | make dist - persist_to_workspace: root: "." paths: - "amavisd-milter-*.tar.gz" release: docker: - image: cibuilds/github:0.12 steps: - attach_workspace: at: /tmp/workspace - run: name: "Publish Release on GitHub" command: | if [ ! -f /tmp/workspace/amavisd-milter-${CIRCLE_TAG}.tar.gz ]; then echo "ERROR: Release file amavisd-milter-${CIRCLE_TAG}.tar.gz does not exists" exit 1 fi ghr \ -t ${GITHUB_TOKEN} \ -u ${CIRCLE_PROJECT_USERNAME} \ -r ${CIRCLE_PROJECT_REPONAME} \ -c ${CIRCLE_SHA1} \ -n amavisd-milter-${CIRCLE_TAG} \ -delete \ -draft \ -prerelease \ ${CIRCLE_TAG} \ /tmp/workspace/amavisd-milter-${CIRCLE_TAG}.tar.gz workflows: version: 2 main: jobs: - build: filters: # Required since `release` has tag filters AND requires `build` # https://circleci.com/docs/2.0/workflows/#git-tag-job-execution tags: only: /.*/ - release: requires: - build filters: branches: # Release only from the master branch ignore: /.*/ tags: # Release only if it is a SemVer tag # https://github.com/semver/semver/issues/232#issuecomment-431199333 only: /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:((0|[1-9]\d*|\d*[A-Z-a-z-][\dA-Za-z-]*))(\.(0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+(?:[\dA-Za-z-]+(\.[\dA-Za-z-]*)*))?$/