-
Notifications
You must be signed in to change notification settings - Fork 10
64 lines (52 loc) · 1.65 KB
/
spec.yml
File metadata and controls
64 lines (52 loc) · 1.65 KB
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
# name of the action
name: api-spec
# trigger on release events
on:
release:
types: [created]
permissions:
contents: read
# pipeline to execute
jobs:
schema:
runs-on: ubuntu-latest
permissions:
contents: write # for actions/github-script to attach files to release artifacts
steps:
- name: clone
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: install go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
# use version from go.mod file
go-version-file: "go.mod"
cache: true
check-latest: true
- name: tags
run: |
git fetch --tags
- name: create spec
run: |
sudo make spec-install
sudo make spec
- name: upload api spec
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
retries: 3
script: |
const fs = require('fs');
const path = './api-spec.json';
const name = 'api-spec.json';
const fileContent = fs.readFileSync(path);
const response = await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: context.payload.release.id,
name: name,
data: fileContent,
headers: {
'content-type': 'text/plain',
'content-length': fileContent.length,
},
});
core.info(`Uploaded asset: ${response.data.browser_download_url}`);