Skip to content

Commit 8588d1c

Browse files
authored
Promote from git tag (#2)
1 parent 7397c6b commit 8588d1c

File tree

2 files changed

+84
-3
lines changed

2 files changed

+84
-3
lines changed

.circleci/config.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,37 @@ version: 2.1
22
description: Creates and updates the CHANGELOG.md file
33

44
orbs:
5-
orb-tools: circleci/orb-tools@2.0.0
5+
orb-tools: circleci/orb-tools@9.0.0
66

77
workflows:
8-
btd:
8+
sdk:
9+
jobs:
10+
-
11+
orb-tools/publish:
12+
orb-path: src/sdk.yml
13+
orb-ref: ory/sdk@dev:${CIRCLE_BRANCH}
14+
publish-token-variable: CIRCLECI_DEV_API_TOKEN
15+
validate: true
16+
- orb-tools/dev-promote-prod-from-git-tag:
17+
orb-name: ory/sdk
18+
add-pr-comment: false
19+
filters:
20+
tags:
21+
only: /.*/
22+
branches:
23+
ignore: /.*/
24+
changelog:
925
jobs:
1026
- orb-tools/publish:
1127
orb-path: src/changelog.yml
1228
orb-ref: ory/changelog@dev:${CIRCLE_BRANCH}
13-
publish-token-variable: "$CIRCLECI_DEV_API_TOKEN"
1429
validate: true
30+
publish-token-variable: CIRCLECI_DEV_API_TOKEN
31+
- orb-tools/dev-promote-prod-from-git-tag:
32+
orb-name: ory/changelog
33+
add-pr-comment: false
34+
filters:
35+
tags:
36+
only: /.*/
37+
branches:
38+
ignore: /.*/

src/sdk.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
version: 2.1
2+
description: Generates the Go SDK
3+
4+
orbs:
5+
sdk:
6+
executors:
7+
changelog:
8+
docker:
9+
-
10+
image: circleci/go:1.13
11+
jobs:
12+
generate:
13+
parameters:
14+
gitemail:
15+
description: The git committer's email
16+
type: string
17+
18+
gitusername:
19+
description: The git committer's username
20+
type: string
21+
default: aeneasr
22+
gitauthtoken:
23+
description: A GitHub API Token
24+
type: env_var_name
25+
default: GITHUB_TOKEN
26+
executor: changelog
27+
steps:
28+
- run: git config --global push.default matching
29+
- checkout
30+
- run: |
31+
if [ "$(git show -s --format=%B | head -n 1)" != "Update SDK" ]]; then
32+
echo "Generating SDK"
33+
go install github.com/go-swagger/go-swagger/cmd/swagger github.com/ory/x/tools/listx github.com/sqs/goreturns
34+
swagger generate spec -m -o ./docs/api.swagger.json -x sdk
35+
swagger validate ./docs/api.swagger.json"
36+
rm -rf ./sdk/go/$CIRCLE_PROJECT_REPONAME
37+
swagger generate client -f ./docs/api.swagger.json -t sdk/go/$CIRCLE_PROJECT_REPONAME -A "Ory_$(tr '[:lower:]' '[:upper:]' <<< "${CIRCLE_PROJECT_REPONAME:0:1}")${CIRCLE_PROJECT_REPONAME:1})"
38+
goreturns -w -local github.com/ory $(listx .)
39+
git config --global user.email "<<parameters.gitemail>>"
40+
git config --global user.name "<<parameters.gitusername>>"
41+
git commit -m "Update SDK" -a || true
42+
git push origin || true
43+
else
44+
echo "Skipping SDK generation"
45+
fi
46+
47+
examples:
48+
sdk:
49+
description: Generate and commit the SDK
50+
usage:
51+
version: 2.1
52+
orbs:
53+
54+
workflows:
55+
generate:
56+
jobs:
57+
- sdk/generate

0 commit comments

Comments
 (0)