-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 2.57 KB
/
spectral.yaml
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
name: Quality Pipeline
permissions: write-all
on:
pull_request:
branches:
- main # or master, or whatever branch you target with PRs
release:
types:
- created
jobs:
lint:
runs-on: ubuntu-latest
environment:
name: GithubActions
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20' # or your preferred Node version
- name: Install dependencies
run: yarn install
- name: Generate OpenAPI spec
run: yarn generate
# Run Spectral
- uses: stoplightio/spectral-action@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file_glob: 'spec/*.json'
# Extra step that runs only on release
- name: Update Documentation
run: yarn updatePostman
env:
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}
if: github.event_name == 'release'
- name: Setup Deck
run: |
curl -sL https://github.com/kong/deck/releases/download/v1.25.0/deck_1.25.0_linux_amd64.tar.gz -o deck.tar.gz
tar -xf deck.tar.gz -C /tmp
sudo cp /tmp/deck /usr/local/bin/
# Ping to your Kong instance
- name: decK ping
id: decK_ping
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DECK_GROUP_NAME: ${{ secrets.DECK_GROUP_NAME }}
DECK_PAT: ${{ secrets.DECK_PAT }}
run: deck ping --konnect-runtime-group-name ${{ secrets.DECK_GROUP_NAME }} --konnect-token ${{ secrets.DECK_PAT }}
if: github.event_name == 'release'
# Generate Config File to sync
- name: decK file openapi2kong
id: deck_file_openapi2kong
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DECK_GROUP_NAME: ${{ secrets.DECK_GROUP_NAME }}
DECK_PAT: ${{ secrets.DECK_PAT }}
run: deck file openapi2kong --spec ./spec/petStore.json --output-file ./kong/petStoreKong.yaml
if: github.event_name == 'release'
# Sync the state of the files to the Kong instance and update the deployment status in your repo by GitHub Deployment API
- name: decK sync
id: decK_sync
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DECK_GROUP_NAME: ${{ secrets.DECK_GROUP_NAME }}
DECK_PAT: ${{ secrets.DECK_PAT }}
run: deck sync -s ./kong/petStoreKong.yaml --konnect-runtime-group-name ${{ secrets.DECK_GROUP_NAME }} --konnect-token ${{ secrets.DECK_PAT }}
if: github.event_name == 'release'