Skip to content

[github-actions] Automatic release on new tags (#60) #4

[github-actions] Automatic release on new tags (#60)

[github-actions] Automatic release on new tags (#60) #4

name: Automatic Release on Push
on:
push:
tags:
- '*'
jobs:
automatic-release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: 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
if: startsWith(github.ref, 'refs/tags/')
run: buf push
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
make_latest: true
body: |
Automatic release of the OpenAPI spec and the Buf image
files: |
openapi.yaml
mobility.binpb