-
Notifications
You must be signed in to change notification settings - Fork 30
107 lines (86 loc) · 3.29 KB
/
sdk-postman.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
on:
push:
paths:
- 'api-specs/**'
workflow_dispatch:
name: "SDK Generator Postman"
permissions: {}
jobs:
diff:
name: "Show changes"
runs-on: ubuntu-latest
steps:
- name: "Checkout api reference"
uses: actions/checkout@v3
with:
path: commercetools-api-reference
- name: "Checkout previous api reference"
uses: actions/checkout@v3
with:
fetch-depth: 50
path: commercetools-api-reference-previous
- name: 'Setup Java'
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '16'
- name: Show commit ID
run: echo "previous=$(git log --format='%H' --no-merges -n 1 --skip 1)" >> $GITHUB_ENV
working-directory: commercetools-api-reference-previous
- name: "Switch to previous commit"
run: git checkout ${{ env.previous }}
working-directory: commercetools-api-reference-previous
- name: "Install codegen"
run: curl -o- -s https://raw.githubusercontent.com/commercetools/rmf-codegen/main/scripts/install.sh | bash
- name: "Calculate diff"
run: rmf-codegen diff -f JSON commercetools-api-reference-previous/api-specs/api/api.raml commercetools-api-reference/api-specs/api/api.raml
postman:
name: "Generate postman collection"
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: 'Setup Java'
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '16'
- name: "Checkout api reference"
uses: actions/checkout@v3
with:
path: commercetools-api-reference
- name: "Checkout postman collection"
uses: actions/checkout@v3
with:
repository: 'commercetools/commercetools-postman-collection'
path: postman
ssh-key: ${{ secrets.POSTMAN_DEPLOY_KEY }}
- name: "Generate api postman collection"
run: sudo chmod 777 /usr/local/bin && make build
working-directory: postman
env:
RAML_FILE: "../commercetools-api-reference/api-specs/api/postman.raml"
LIB_NAME: "api"
- name: "Generate importapi postman collection"
run: sudo chmod 777 /usr/local/bin && make build
working-directory: postman
env:
RAML_FILE: "../commercetools-api-reference/api-specs/importapi/api.raml"
LIB_NAME: "import"
- name: "Generate connect postman collection"
run: sudo chmod 777 /usr/local/bin && make build
working-directory: postman
env:
RAML_FILE: "../commercetools-api-reference/api-specs/connect/api.raml"
LIB_NAME: "connect"
- name: "check pending changes"
run: echo "CHANGES_PENDING=`git status --porcelain -- ':(exclude)*gen.properties' | grep -c ^`" >> $GITHUB_ENV
working-directory: postman
- uses: stefanzweifel/git-auto-commit-action@v4
if: env.CHANGES_PENDING != '0' && github.ref == 'refs/heads/main'
with:
repository: postman
branch: master
commit_message: "TASK: Updating Postman collection"
commit_user_name: Auto Mation
commit_user_email: [email protected]
commit_author: Auto Mation <[email protected]>