Skip to content

Commit

Permalink
Merge pull request #6 from aserto-dev/readmio
Browse files Browse the repository at this point in the history
Use readmeio/rdme@v8 action to publish spec
  • Loading branch information
ronenh authored Apr 1, 2024
2 parents 6b579cb + 099cf92 commit 7f717d1
Showing 1 changed file with 10 additions and 35 deletions.
45 changes: 10 additions & 35 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Read Configuration
uses: hashicorp/vault-action@v2.4.1
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
Expand All @@ -35,12 +35,12 @@ jobs:
kv/data/github "READ_WRITE_TOKEN" | READ_WRITE_TOKEN;
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

Expand Down Expand Up @@ -88,44 +88,19 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Read Configuration
uses: hashicorp/vault-action@v2.4.1
uses: hashicorp/vault-action@v3
id: vault
with:
url: ${{ env.VAULT_ADDR }}
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
kv/data/readme "README_VERSION_API_KEY" | README_VERSION_API_KEY;
kv/data/readme "README_OAS_AUTHORIZER_KEY" | README_OAS_AUTHORIZER_KEY;
kv/data/readme "AUTHORIZER_API_DEFINITION_ID" | AUTHORIZER_API_DEFINITION_ID;
- name: Checkout
uses: actions/checkout@v2
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js 18
uses: actions/setup-node@v3
- name: Publish to readme.io
uses: readmeio/rdme@v8
with:
node-version: 18

- name: Update API spec version
id: latest_readmeio_version
shell: bash
run: |
echo "Install rdme"
npm install [email protected]
echo "Npm fund"
npm fund
echo "Get versions"
LATEST_READMEIO_VERSION=$(curl -X GET \
https://dash.readme.io/api/v1/version \
-u ${{ steps.vault.outputs.README_VERSION_API_KEY }}:)
echo "Compute latest versions"
LATEST_READMEIO_VERSION=$(echo "$LATEST_READMEIO_VERSION" | jq -r 'sort_by(.createdAt)[-1].version')
echo "$LATEST_READMEIO_VERSION"
echo "Publish authorizer API spec"
npx rdme openapi ./publish/authorizer/openapi.json --key ${{ steps.vault.outputs.README_VERSION_API_KEY }} --id ${{ steps.vault.outputs.AUTHORIZER_API_DEFINITION_ID }}
echo "Update API spec version"
npx rdme versions:update --version=$LATEST_READMEIO_VERSION --key ${{ steps.vault.outputs.README_VERSION_API_KEY }} --isPublic true --main true --beta false <<< ${{ env.RELEASE_VERSION }}
rdme: openapi ./publish/directory/openapi.json --key=${{ stepa.vault.outputs.README_OAS_AUTHORIZER_KEY }} --id ${{ steps.vault.outputs.AUTHORIZER_API_DEFINITION_ID }}

0 comments on commit 7f717d1

Please sign in to comment.