-
-
Notifications
You must be signed in to change notification settings - Fork 7
80 lines (69 loc) · 2.87 KB
/
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
name: Build and test Postman collection
on:
push:
branches:
- develop
pull_request:
jobs:
build:
name: Build documentation
runs-on: ubuntu-18.04
steps:
- name: Set deploy env
run: |
echo "off_env=${{ github.ref == 'refs/heads/develop' && 'off-org' || 'off-net'}}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Install docgen
run: curl https://raw.githubusercontent.com/thedevsaddam/docgen/v3/install.sh -o install.sh && chmod +x install.sh && ./install.sh && rm install.sh
- name: Generate HTML documentation
run: docgen build -i off-pm-collection.json -e ${{ env.off_env }}-env.json -o index.html
# TODO: Debug this as it hangs
# - name: Generate Markdown documentation
# run: docgen build -i off-pm-collection.json -e off-pm-env.json -o index.md -m
- name: Commit generated documentation to current branch
uses: stefanzweifel/git-auto-commit-action@v4
with:
repository: .
file_pattern: index.*
commit_message: Commit docgen-generated docs
commit_options: '--no-verify --signoff'
- name: Deploy HTML docs to Github Pages [STAGING]
uses: JamesIves/[email protected]
if: ${{ startsWith(github.ref, 'refs/pull') }}
with:
token: ${{ secrets.CROSS_REPO_TOKEN }}
branch: gh-pages # <- Branch on which commit will be made
repository-name: openfoodfacts/api-documentation-staging
folder: . # <- Folder containing our generated HTML docs
- name: Add comment to PR
uses: thollander/[email protected]
if: ${{ startsWith(github.ref, 'refs/pull') }}
with:
message: Staging documentation deployed to https://openfoodfacts.github.io/api-documentation-staging
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy HTML docs to Github Pages [PROD]
uses: JamesIves/[email protected]
if: ${{ github.ref == 'refs/heads/master' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages # <- Branch on which commit will be made
folder: . # <- Folder containing our generated HTML docs
test:
name: Run API integration tests
runs-on: ubuntu-18.04
steps:
- name: Set deploy env
run: |
echo "off_env=${{ github.ref == 'refs/heads/master' && 'off-org' || 'off-net'}}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Run API Tests
id: run-newman
uses: anthonyvscode/newman-action@v1
with:
collection: off-pm-collection.json
environment: ${{ env.off_env }}-env.json
reporters: cli
- name: Output summary to console
run: echo ${{ steps.run-newman.outputs.summary }}