Publish Identus-cloud-agent clients #55
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: Publish Identus-cloud-agent clients | |
on: | |
workflow_call: | |
inputs: | |
revision: | |
description: "Revision to build and publish clients (e.g. 1.33.0-a3j4456-1)" | |
required: true | |
type: string | |
check_sum: | |
description: "Checksum of the OAS specification" | |
required: true | |
type: string | |
workflow_dispatch: | |
inputs: | |
releaseTag: | |
description: "Tag to release clients (e.g. cloud-agent-v1.33.0)" | |
required: false | |
type: string | |
revision: | |
description: "Revision to build and publish clients (e.g. 1.33.0-a3j4456-1)" | |
required: false | |
type: string | |
check_sum: | |
description: "Checksum of the OAS specification" | |
required: false | |
type: string | |
push: | |
tags: | |
- "cloud-agent-v*" | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
publish-clients: | |
name: "Build and publish Identus Cloud Agent clients" | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_ACTOR: "hyperledger-bot" | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "lts/*" | |
registry-url: https://npm.pkg.github.com/ | |
scope: "@hyperledger" | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Setup Gradle | |
uses: gradle/[email protected] | |
- name: Login to Github Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ env.GITHUB_ACTOR }} | |
password: ${{ env.GITHUB_TOKEN }} | |
- name: Setup yq - portable yaml processor | |
uses: mikefarah/[email protected] | |
- name: Delete existing Open API specification | |
if: ${{ !inputs.releaseTag }} | |
run: | | |
echo "Current directory: $(pwd)" | |
rm -f ./cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml | |
- name: Download OpenAPI specification | |
if: ${{ !inputs.releaseTag }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: cloud-agent-openapi-spec-${{ inputs.check_sum }} | |
path: ./cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml | |
- name: WTF | |
run: | | |
echo "Current directory: $(pwd)" | |
ls -la ./cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml | |
cat ./cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml | |
- name: Set revision version | |
if: ${{ !inputs.releaseTag }} | |
working-directory: cloud-agent/client/generator | |
run: yarn version --new-version ${{ inputs.revision }} --no-git-tag-version | |
- name: Install generator dependencies | |
working-directory: cloud-agent/client/generator | |
run: yarn install | |
- name: Generate clients | |
working-directory: cloud-agent/client/generator | |
run: yarn generate:all | |
- name: Publish clients | |
working-directory: cloud-agent/client/generator | |
run: | | |
if [ -z "${{ github.event.inputs.releaseTag }}" ]; then | |
echo "Using revision version for publishing: ${{ inputs.revision }}" | |
yarn publish:clients --new-version ${{ inputs.revision }} | |
else | |
echo "Using release tag for publishing: ${{ github.event.inputs.releaseTag }}" | |
yarn publish:clients --new-version ${{ github.event.inputs.releaseTag }} | |
fi |