Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(buf): use new buf gh action #569

Merged
merged 15 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 66 additions & 31 deletions .github/workflows/packages.yml → .github/workflows/proto.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,67 @@
name: release-packages
name: proto

on:
push:
tags:
- 'v*'
pull_request:
branches:
- main

jobs:
java:
buf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: bufbuild/buf-setup-action@v1
- uses: bufbuild/buf-action@v1
with:
token: ${{ secrets.BUF_TOKEN }}
setup_only: false
github_token: ${{ secrets.GITHUB_TOKEN }}
breaking_against: "https://github.com/stroeer/tapir.git#branch=main"

java:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
distribution: 'temurin'
java-version: '21'

- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-dependencies-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/java/**/*.gradle*') }}
restore-keys: |
gradle-${{ runner.os }}-dependencies-

- uses: bufbuild/buf-action@v1
with:
setup_only: true
github_token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.BUF_TOKEN }}

- name: generate
run: make generate

- name: test
working-directory: java
run: ./gradlew clean build

- name: publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
working-directory: java
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_TAG=${GITHUB_REF/refs\/tags\/v/}
echo $RELEASE_TAG
./gradlew -Pversion=$RELEASE_TAG clean build publish
./gradlew -Pversion=$RELEASE_TAG clean publish

node:
runs-on: ubuntu-latest
Expand All @@ -47,23 +78,26 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: bufbuild/buf-setup-action@v1
- uses: bufbuild/buf-action@v1
with:
setup_only: true
github_token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.BUF_TOKEN }}

# we need Node for the local execution of protoc Typescript plugin
- name: install
run: npm ci
working-directory: node
run: npm ci

- name: generate
run: make generate TEMPLATE=buf.gen.node.yaml

- name: checks
run: npm run checks
working-directory: node
run: npm run checks

- name: publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
working-directory: node
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -87,26 +121,29 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: bufbuild/buf-setup-action@v1
- uses: bufbuild/buf-action@v1
with:
setup_only: true
github_token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.BUF_TOKEN }}

- name: install
run: npm ci
working-directory: node-proto
run: npm ci

- name: generate
run: make generate TEMPLATE=buf.gen.node-proto.yaml

- name: build
run: npm run build
working-directory: node-proto
run: npm run build

- name: checks
run: npm run checks
working-directory: node-proto
run: npm run checks

- name: publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
working-directory: node-proto
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -117,31 +154,29 @@ jobs:
npm publish

go:
runs-on: ubuntu-latest
steps:
- name: start release workflow in go-tapir
run: |
RELEASE_TAG=${GITHUB_REF/refs\/tags\/v/}
echo $RELEASE_TAG
curl -X POST https://api.github.com/repos/stroeer/go-tapir/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.GO_TAPIR_TOKEN }} \
--data '{"event_type": "publish", "client_payload": { "tag": "'"$RELEASE_TAG"'" }}'


bsr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: bufbuild/buf-setup-action@v1
- uses: actions/setup-go@v5
with:
go-version: '1.20'

- uses: bufbuild/buf-action@v1
with:
setup_only: true
github_token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.BUF_TOKEN }}

- name: push
env:
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
- name: generate
run: make generate TEMPLATE=buf.gen.go.yaml

- name: publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: |
RELEASE_TAG=${GITHUB_REF/refs\/tags\/v/}
echo $RELEASE_TAG
make push
curl -X POST https://api.github.com/repos/stroeer/go-tapir/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.GO_TAPIR_TOKEN }} \
--data '{"event_type": "publish", "client_payload": { "tag": "'"$RELEASE_TAG"'" }}'
126 changes: 0 additions & 126 deletions .github/workflows/pull-request.yml

This file was deleted.

2 changes: 1 addition & 1 deletion buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ modules:

lint:
use:
- DEFAULT
- STANDARD
except:
- ENUM_VALUE_PREFIX
- RPC_RESPONSE_STANDARD_NAME
Expand Down
Loading
Loading