From 83140ccdcec9b04fc2fdf827eeb9a07fc39a4449 Mon Sep 17 00:00:00 2001 From: Moritz Zimmer Date: Mon, 9 Sep 2024 11:29:54 +0200 Subject: [PATCH] draft for unified gh workflow (starting with java) --- .github/workflows/buf.yaml | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/buf.yaml diff --git a/.github/workflows/buf.yaml b/.github/workflows/buf.yaml new file mode 100644 index 00000000..325836b6 --- /dev/null +++ b/.github/workflows/buf.yaml @@ -0,0 +1,55 @@ +name: buf + +on: + push: + tags: + - 'v*' + pull_request: + branches: + - main + +jobs: + java: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: action/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - 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 publish + + buf: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - 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"