-
Notifications
You must be signed in to change notification settings - Fork 4
58 lines (48 loc) · 1.51 KB
/
automatic-release.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
name: Automatic Release on Push
on:
pull_request:
types:
- closed
jobs:
automatic-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install yq
run: sudo snap install yq
- name: Setup buf environment
uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
setup_only: true
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate buf image
run: buf build -o mobility.binpb
- name: Generate OpenAPI spec
run: |
buf generate
# Merge the generated OpenAPI file with the OpenAPI base file
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' gen/openapi.yaml templates/openapi.base.yaml > openapi.yaml
- name: Push to Buf Schema Registry
run: buf push
- name: Bump version and push tag
id: tag
uses: anothrNick/github-tag-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.new_tag }}
token: ${{ secrets.GITHUB_TOKEN }}
make_latest: true
body: |
Automatic release of the OpenAPI spec and the Buf image
files: |
openapi.yaml
mobility.binpb