-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (36 loc) · 962 Bytes
/
publish.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
name: publish
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
publish:
name: publish buf module
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup go
uses: actions/setup-go@v4
with:
go-version: '^1.21'
- name: install buf
run: make bin/buf
- name: login to BSR
env:
BUF_USER: ${{ vars.BUF_USER }}
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
run: |
echo "$BUF_TOKEN" | bin/buf registry login --username "$BUF_USER" --token-stdin
- name: publish to BSR main
if: ${{ github.ref == 'refs/heads/main' }}
run: bin/buf push -v src
- name: publish to BSR branch
if: ${{ github.ref != 'refs/heads/main' }}
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: bin/buf push -v --branch "$BRANCH_NAME" src
- name: logout BSR
run: bin/buf registry logout