Skip to content

Commit from GitHub Actions (ci) #127

Commit from GitHub Actions (ci)

Commit from GitHub Actions (ci) #127

Workflow file for this run

---
name: ci
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
proto_ref:
proto_sha:
push:
branches:
- main
- v*
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for PRs
pull_request:
env:
VAULT_ADDR: https://vault.eng.aserto.com/
GO_VERSION: "1.23"
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Read Configuration
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/github "SSH_PRIVATE_KEY" | SSH_PRIVATE_KEY;
kv/data/github "READ_WRITE_TOKEN" | READ_WRITE_TOKEN;
-
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.CODEGEN_APP_ID }}
private-key: ${{ secrets.CODEGEN_APP_KEY }}
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
-
name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
-
name: Install dependencies
run: |
go run mage.go deps
-
name: Clean generated code
run: go run mage.go clean
-
name: Generate
run: go run mage.go generate
-
name: Commit changes
id: commit_changes
if: github.event_name == 'workflow_dispatch'
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Read Configuration
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/readme "README_OAS_DIRECTORY_KEY" | README_OAS_DIRECTORY_KEY;
kv/data/readme "DIRECTORY_API_DEFINITION_ID" | DIRECTORY_API_DEFINITION_ID;
- name: Checkout
uses: actions/checkout@v4
- name: Create openapi.readmeio.json
run: |
cat publish/directory/openapi.json | jq ".servers=$(cat config/readmeio.servers.json)" > openapi.readmeio.json
- name: Publish to readme.io
uses: readmeio/rdme@v8
with:
rdme: openapi ./openapi.readmeio.json --key=${{ steps.vault.outputs.README_OAS_DIRECTORY_KEY }} --id ${{ steps.vault.outputs.DIRECTORY_API_DEFINITION_ID }}