ci: Automatically create a tag upon merge to master

This commit is contained in:
Enrico Stahn 2018-06-27 09:37:38 +10:00
parent 03d87088d7
commit d9e3c6f233
No known key found for this signature in database
GPG key ID: 5263621C269A50DE
2 changed files with 19 additions and 10 deletions

View file

@ -17,23 +17,23 @@ jobs:
chmod +x ./cc-test-reporter chmod +x ./cc-test-reporter
- run: curl -L -s https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 -o /go/bin/dep && chmod +x /go/bin/dep - run: curl -L -s https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 -o /go/bin/dep && chmod +x /go/bin/dep
- run: dep ensure -vendor-only - run: dep ensure -vendor-only
- run: curl -L -s https://github.com/alecthomas/gometalinter/releases/download/v2.0.5/gometalinter-2.0.5-linux-amd64.tar.gz | tar xvfz - -C /go/bin/ --strip 1
- run: gometalinter --disable-all --enable=megacheck --enable=golint --enable=unconvert --enable=vet --enable=vetshadow --vendor ./...
- run: - run:
name: Run tests name: Run tests
command: | command: |
./cc-test-reporter before-build CC_TEST_REPORTER_ID=5a29fe5d2c613af8a8a4f41f8e3a0a0d74895ecc6dc5deb84664ad46a48d1ce6 ./cc-test-reporter before-build
go test -v -coverprofile=c.out ./... go test -v -coverprofile=c.out ./...
CC_TEST_REPORTER_ID=5a29fe5d2c613af8a8a4f41f8e3a0a0d74895ecc6dc5deb84664ad46a48d1ce6 ./cc-test-reporter after-build --exit-code $? CC_TEST_REPORTER_ID=5a29fe5d2c613af8a8a4f41f8e3a0a0d74895ecc6dc5deb84664ad46a48d1ce6 ./cc-test-reporter after-build --exit-code $?
lint: release:
<<: *defaults <<: *defaults
docker: docker:
- image: circleci/golang:1.10 - image: circleci/node:9
steps: steps:
- checkout - checkout
- run: curl -L -s https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 -o /go/bin/dep && chmod +x /go/bin/dep - run: yarn global add --prefer-offline --no-progress --non-interactive "semantic-release@15.5.0" "@semantic-release/exec@2.2.4"
- run: dep ensure -vendor-only - run: $(yarn global bin)/semantic-release
- run: curl -L -s https://github.com/alecthomas/gometalinter/releases/download/v2.0.5/gometalinter-2.0.5-linux-amd64.tar.gz | tar xvfz - -C /go/bin/ --strip 1
- run: gometalinter --disable-all --enable=megacheck --enable=golint --enable=unconvert --enable=vet --enable=vetshadow --vendor ./...
deploy: deploy:
<<: *defaults <<: *defaults
@ -41,8 +41,7 @@ jobs:
- image: circleci/golang:1.10 - image: circleci/golang:1.10
steps: steps:
- checkout - checkout
- setup_remote_docker: - setup_remote_docker
docker_layer_caching: true
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS - run: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run: curl -L -s https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 -o /go/bin/dep && chmod +x /go/bin/dep - run: curl -L -s https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 -o /go/bin/dep && chmod +x /go/bin/dep
- run: dep ensure -vendor-only - run: dep ensure -vendor-only
@ -60,6 +59,10 @@ workflows:
filters: filters:
tags: tags:
only: /^v.*/ only: /^v.*/
- release:
filters:
branches:
only: master
- deploy: - deploy:
requires: requires:
- test - test
@ -67,4 +70,4 @@ workflows:
branches: branches:
ignore: /.*/ ignore: /.*/
tags: tags:
only: /^v.*/ only: /^v.*/

6
.releaserc Normal file
View file

@ -0,0 +1,6 @@
---
repositoryUrl: https://github.com/hipages/php-fpm_exporter
verifyConditions: ['@semantic-release/github']
prepare: []
success: ['@semantic-release/github']
fail: ['@semantic-release/github']