Skip to content

Commit be3151d

Browse files
author
jasonwalsh
committed
feat: Use semantic release for GitHub releases
1 parent e139157 commit be3151d

File tree

3 files changed

+72
-54
lines changed

3 files changed

+72
-54
lines changed

.circleci/config.yml

Lines changed: 43 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,64 @@
1-
commands:
2-
terraform:
3-
description: Download Terraform
4-
steps:
5-
- run:
6-
command: |
7-
wget -O terraform.zip https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip
8-
sudo unzip -d /usr/local/bin terraform.zip
91
jobs:
10-
build:
2+
pre-commit:
113
docker:
12-
- image: circleci/golang:1.11-stretch-browsers-legacy
4+
- image: quay.io/mongodb-build/terratest
135
steps:
146
- checkout
15-
- terraform
16-
- run:
17-
command: terraform init
18-
working_directory: /go/src/github.com/mongodb/terraform-aws-ecs-task-definition
7+
- restore_cache:
8+
key: v1-venv
9+
- run: |
10+
virtualenv venv
11+
. venv/bin/activate
12+
13+
pip install pre-commit
14+
pre-commit install
15+
pre-commit run --all-files
16+
- save_cache:
17+
key: v1-venv
18+
paths:
19+
- venv
1920
test:
2021
docker:
21-
- image: circleci/golang:1.11-stretch-browsers-legacy
22+
- image: quay.io/mongodb-build/terratest
2223
steps:
2324
- checkout
24-
- terraform
25-
- run:
26-
command: |
27-
terraform init
28-
terraform fmt -check=true
29-
terraform validate
30-
31-
dep ensure
32-
go test -v ./...
33-
working_directory: /go/src/github.com/mongodb/terraform-aws-ecs-task-definition
25+
- restore_cache:
26+
key: gopkg-{{ checksum "Gopkg.lock" }}
27+
- run: |
28+
dep ensure
29+
go test -timeout 30m -v ./...
30+
- save_cache:
31+
key: gopkg-{{ checksum "Gopkg.lock" }}
32+
paths:
33+
- vendor
34+
working_directory: /go/src/github.com/10gen/terraform-mongohouse
3435
deploy:
3536
docker:
36-
- image: circleci/golang:1.11-stretch-browsers-legacy
37+
- image: circleci/node:8
3738
steps:
3839
- checkout
39-
- run:
40-
command: |
41-
go get github.com/tcnksm/ghr
42-
VERSION="$(git tag -l | head -1)"
43-
ghr -t "${GITHUB_TOKEN}" -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" -c "${CIRCLE_SHA1}" -delete "${VERSION}" .
44-
version: 2.1
40+
- restore_cache:
41+
key: v1-npm
42+
- run: |
43+
sudo npm install @semantic-release/changelog -D
44+
sudo npm install @semantic-release/git -D
45+
npx semantic-release
46+
- save_cache:
47+
key: v1-npm
48+
paths:
49+
- node_modules
50+
version: 2.0
4551
workflows:
46-
build-test-deploy:
52+
pre-commit-test-deploy:
4753
jobs:
48-
- build:
49-
filters:
50-
tags:
51-
only: /.*/
54+
- pre-commit
5255
- test:
53-
filters:
54-
tags:
55-
only: /.*/
5656
requires:
57-
- build
58-
- pause:
59-
filters:
60-
branches:
61-
ignore: /.*/
62-
tags:
63-
only: /^v.*/
64-
requires:
65-
- test
66-
type: approval
57+
- pre-commit
6758
- deploy:
6859
filters:
6960
branches:
70-
ignore: /.*/
71-
tags:
72-
only: /^v.*/
61+
only: master
7362
requires:
74-
- pause
63+
- test
7564
version: 2

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- hooks:
3+
- id: terraform_docs
4+
- id: terraform_fmt
5+
repo: https://github.com/antonbabenko/pre-commit-terraform.git
6+
rev: v1.11.0
7+
8+
- hooks:
9+
- id: go-fmt
10+
- id: go-lint
11+
exclude: vendor
12+
repo: https://github.com/dnephin/pre-commit-golang.git
13+
rev: v0.3.3

.releaserc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"plugins": [
3+
"@semantic-release/commit-analyzer",
4+
"@semantic-release/github",
5+
"@semantic-release/release-notes-generator",
6+
"@semantic-release/changelog",
7+
[
8+
"@semantic-release/git",
9+
{
10+
"assets": [
11+
"CHANGELOG.md"
12+
]
13+
}
14+
]
15+
]
16+
}

0 commit comments

Comments
 (0)