Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 65 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,82 @@
version: 2
version: 2.1
tagged_build_filters: &tagged_build_filters
branches:
ignore: /.*/
tags:
only: /v[0-9]+\.[0-9]+\.[0-9]+/
jobs:
publish:
build:
docker:
- image: circleci/python:3
steps:
- checkout
- run:
name: Check Tagged Push
command: |
TAG_VERSION=$(git tag -l --sort=-v:refname | head -n 1 | cut -d'-' -f2)
PKG_VERSION=$(cat logdna/VERSION)
if [[ "${TAG_VERSION}" != "${PKG_VERSION}" ]]; then
if [[ "${CIRCLE_TAG}" != "v${PKG_VERSION}" ]]; then
echo "There is mismatch:"
echo " TAG_VERSION: ${TAG_VERSION}"
echo " PKG_VERSION: ${PKG_VERSION}"
echo " TAG_VERSION: ${CIRCLE_TAG}"
echo " PKG_VERSION: v${PKG_VERSION}"
exit 1
fi
- run: python setup.py sdist
- persist_to_workspace:
root: .
paths:
- ./dist/logdna-*.tar.gz
release:
docker:
- image: circleci/golang:1.12
steps:
- attach_workspace:
at: .
- run: go get -u github.com/tcnksm/ghr
- run:
name: Publish
name: Create a Release
command: |
sudo pip install twine
python setup.py sdist
twine upload dist/*.tar.gz
ghr \
-n "LogDNA Python Logger ${CIRCLE_TAG}" \
-t ${GITHUB_TOKEN} \
-u ${CIRCLE_PROJECT_USERNAME} \
-r ${CIRCLE_PROJECT_REPONAME} \
-draft ${CIRCLE_TAG} ${CIRCLE_WORKING_DIRECTORY}/dist
- persist_to_workspace:
root: .
paths:
- ./dist/logdna-*.tar.gz
approve:
machine: true
steps:
- attach_workspace:
at: .
- persist_to_workspace:
root: .
paths:
- ./dist/logdna-*.tar.gz
publish:
docker:
- image: circleci/python:3
steps:
- attach_workspace:
at: .
- run: sudo pip install twine
- run: twine upload dist/logdna-*.tar.gz
workflows:
version: 2
update_package:
update:
jobs:
- build:
filters: *tagged_build_filters
- release:
requires:
- build
filters: *tagged_build_filters
- approve:
type: approval
requires:
- release
filters: *tagged_build_filters
- publish:
filters:
tags:
only: /[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?/
branches:
ignore: /.*/
requires:
- approve
filters: *tagged_build_filters