-
Notifications
You must be signed in to change notification settings - Fork 26
63 lines (63 loc) · 2.08 KB
/
generate-single-openapi-spec.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
name: generate-single-openapi-spec
run-name: Build and publish single-file OpenAPI specs
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build-single-spec:
name: Build single-file OpenAPI specifications
runs-on: ubuntu-latest
container:
image: openapitools/openapi-generator-cli:v7.3.0
env:
OPENAPI_GENERATOR_COMMAND: docker-entrypoint.sh
steps:
- uses: actions/checkout@v4
- name: Install pre-requisites
run: |
apt-get update
apt-get install -yqq \
gettext-base
- name: Validate multi-file OpenAPI specification
run: |
$OPENAPI_GENERATOR_COMMAND validate -i openapi.yaml
- name: Refresh single-file OpenAPI specifications
run: |
./generator/script/generate.sh \
generator/configuration/openapi.yaml \
generator/configuration/openapi-yaml.yaml
- name: Store generated artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ github.workflow }}-${{ github.run_id }}-${{ github.run_number }}
path: generated/artifacts
commit-single-spec:
name: Commit and push single-file OpenAPI specifications
runs-on: ubuntu-latest
needs: build-single-spec
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- uses: actions/download-artifact@v4
with:
name: artifacts-${{ github.workflow }}-${{ github.run_id }}-${{ github.run_number }}
path: generated/artifacts
- name: Commit and push single-file OpenAPI specifications
run: |
git --version
if [ -z "$(git status --porcelain=v1 generated/artifacts)" ];
then
echo "no change detected"
else
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git status generated/artifacts
git commit -m "Single file specifications refresh" generated/artifacts
git push
fi