-
Notifications
You must be signed in to change notification settings - Fork 1
/
buf-ci.yaml
35 lines (35 loc) · 1.6 KB
/
buf-ci.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
# This file showcases the Buf CI workflow in a step by step breakdown.
# Based on the buf-ci.yaml file, this action walks through the Buf CI workflow
# and shows what each step does.
name: Buf CI
on:
push:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
delete:
permissions:
contents: read
jobs:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-action@v1
with:
setup_only: true
- env:
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
run: echo ${BUF_TOKEN} | buf registry login buf.build --token-stdin
- run: buf build --error-format=github-actions
- if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'buf skip lint') }}
run: buf lint --error-format github-actions
- if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'buf skip format') }}
run: buf format --diff --error-format github-actions --exit-code
- if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'buf skip breaking') }}
run: |
buf breaking --error-format github-actions --against \
${{ github.event.repository.clone_url }}#format=git,tag=${{ github.event.pull_request.base.sha || github.event.before }}
- if: ${{ github.event_name == 'push' }}
run: buf push --error-format github-actions --create --git-metadata
- if: ${{ github.event_name == 'delete' }}
run: buf beta registry archive --label ${{ github.ref_name }}