-
Notifications
You must be signed in to change notification settings - Fork 23
127 lines (109 loc) · 3.88 KB
/
release-clients.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Publish Identus-cloud-agent clients
run-name: Build and publish Identus Cloud Agent clients from from ${{ github.head_ref || github.ref_name }} run ${{ github.run_number }}
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
- name: Rename OpenAPI specification
if: ${{ !inputs.releaseTag }}
working-directory: cloud-agent/service/api/http
run: |
mv cloud-agent-openapi-spec-${{ inputs.revision }}.yaml 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: Set version for clients
run: |
if [ -z "${{ github.event.inputs.releaseTag }}" ]; then
echo "VERSION_TAG=cloud-agent-v${{ inputs.revision }}" >> $GITHUB_ENV
else
echo "VERSION_TAG=${{ github.event.inputs.releaseTag }}" >> $GITHUB_ENV
fi
- name: Publish clients
working-directory: cloud-agent/client/generator
env:
VERSION_TAG: ${{ env.VERSION_TAG }}
run: |
if [ -z "${{ github.event.inputs.releaseTag }}" ]; then
echo "Using revision version for publishing: ${VERSION_TAG}"
yarn publish:clients
else
echo "Using release tag for publishing: ${VERSION_TAG}"
yarn publish:clients
fi