update makefile (#86) #266
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: build | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
branches: | |
- main | |
env: | |
VAULT_ADDR: https://vault.eng.aserto.com/ | |
BUF_VERSION: "1.34.0" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- | |
name: Read Configuration | |
uses: hashicorp/vault-action@v3 | |
id: vault | |
with: | |
url: ${{ env.VAULT_ADDR }} | |
token: ${{ secrets.VAULT_TOKEN }} | |
secrets: | | |
kv/data/github "USERNAME" | GH_USERNAME; | |
kv/data/github "READ_WRITE_TOKEN" | GH_TOKEN; | |
kv/data/buf.build "ASERTO_BUF_USER" | ASERTO_BUF_USER; | |
kv/data/buf.build "ASERTO_BUF_TOKEN" | ASERTO_BUF_TOKEN; | |
- | |
name: Install svu | |
run: | | |
echo 'deb [trusted=yes] https://apt.fury.io/caarlos0/ /' | sudo tee /etc/apt/sources.list.d/caarlos0.list | |
sudo apt update | |
sudo apt install svu | |
svu --version | |
svu | |
- | |
name: Install buf | |
uses: bufbuild/buf-setup-action@v1 | |
with: | |
version: ${{ env.BUF_VERSION }} | |
github_token: ${{ github.token }} | |
buf_user: ${{ steps.vault.outputs.ASERTO_BUF_USER }} | |
buf_api_token: ${{ steps.vault.outputs.ASERTO_BUF_TOKEN}} | |
- | |
name: Buf Lint | |
uses: bufbuild/buf-lint-action@v1 | |
with: | |
input: "proto" | |
# - | |
# name: Buf Breaking | |
# uses: bufbuild/buf-breaking-action@v1 | |
# with: | |
# input: "proto" | |
# against: "https://github.com/${GITHUB_REPOSITORY}.git#branch=main" | |
- | |
name: Buf Build | |
run: | | |
mkdir -p ./bin | |
buf build --output ./bin/directory.bin | |
- | |
name: Buf Push | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
run: | | |
buf push --label $(svu) | |
trigger-dispatches: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
strategy: | |
matrix: | |
cfg: | |
- { project: go-directory } | |
- { project: node-directory } | |
- { project: dotnet-directory } | |
- { project: ruby-directory } | |
- { project: python-directory } | |
- { project: openapi-directory } | |
- { project: java-directory } | |
name: Generate on ${{ matrix.cfg.project }} | |
steps: | |
- | |
name: Read Configuration | |
uses: hashicorp/vault-action@v3 | |
id: vault | |
with: | |
url: ${{ env.VAULT_ADDR }} | |
token: ${{ secrets.VAULT_TOKEN }} | |
secrets: | | |
kv/data/github "USERNAME" | GH_USERNAME; | |
kv/data/github "READ_WRITE_TOKEN" | GH_TOKEN; | |
- | |
name: Trigger dispatch | |
run: | | |
curl -XPOST -u "${GH_USERNAME}:${GH_TOKEN}" \ | |
-H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" \ | |
https://api.github.com/repos/aserto-dev/${{ matrix.cfg.project }}/actions/workflows/ci.yaml/dispatches --data '{"ref": "main", "inputs": {"proto_ref": "${{ github.ref }}", "proto_sha": "${{ github.sha }}" }}' |