Chore: move push notification stuff into berty messenger #156
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Protobuf | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- main | |
paths: | |
- "api/**" | |
- "Makefile" | |
- "docs/Makefile" | |
- ".github/workflows/protobuf.yml" | |
- "**/gen.sum" | |
- "**.pb.go" | |
- "**.gen.go" | |
- "**.gen.graphql" | |
- "**.gen.yml" | |
- "**.pb.go" | |
- "**/pb_test.go" | |
- "**/docs/*/api.md" | |
- "**/go.mod" | |
- "**/go.sum" | |
pull_request: | |
paths: | |
- "api/**" | |
- "Makefile" | |
- "docs/Makefile" | |
- ".github/workflows/protobuf.yml" | |
- "**/gen.sum" | |
- "**.pb.go" | |
- "**.gen.go" | |
- "**.gen.graphql" | |
- "**.gen.yml" | |
- "**.pb.go" | |
- "**/pb_test.go" | |
- "**/docs/*/api.md" | |
- "**/go.mod" | |
- "**/go.sum" | |
jobs: | |
gen-go-and-docs: | |
if: github.event_name == 'DISABLED' # need to fix it by removing docker for generation | |
name: Generate go protobuf and docs | |
runs-on: ubuntu-latest | |
container: bertytech/buf:1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Unshallow | |
run: git fetch --prune --unshallow | |
- name: Remove lock files | |
run: find . -name gen.sum -delete | |
- name: Load variables from file | |
uses: antifree/[email protected] | |
with: | |
filename: .github/workflows/utils/variables.json | |
- name: Setup asdf | |
uses: asdf-vm/actions/setup@v1 | |
- name: Setup go | |
run: | | |
asdf plugin add golang | |
asdf install golang | |
echo "go_version=$(asdf current golang | xargs | cut -d ' ' -f 2)" >> $GITHUB_ENV | |
- name: Setup jq | |
run: | | |
asdf plugin add jq | |
asdf install jq | |
- name: Cache go modules | |
uses: actions/[email protected] | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}- | |
- name: Fetch go modules | |
run: go mod download | |
- name: Generate docs | |
working-directory: docs | |
run: make generate_local | |
- name: Generate go protobuf | |
run: | | |
make generate_local | |
git checkout go.mod go.sum | |
- name: Check diff | |
run: | | |
git status | cat | |
git diff -w | cat | |
git diff-index -w --quiet HEAD -- | |
- name: Prepare openapi documentation | |
working-directory: docs | |
run: make openapi.prepare | |
- name: Setup apiary | |
run: apk --no-cache add ruby-dev g++ && gem install apiaryio | |
- name: Upload API docs to apiary.io | |
env: | |
APIARY_API_KEY: "${{ secrets.APIARY_API_KEY }}" | |
if: ${{ env.APIARY_API_KEY != 0 }} | |
run: | | |
apiary publish --api-name=bertyprotocol --path="docs/.tmp/openapi/bertyprotocol.swagger.json" || true |