-
Notifications
You must be signed in to change notification settings - Fork 138
238 lines (218 loc) · 9.55 KB
/
node-flow-deploy-release-artifact.yaml
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
##
# Copyright (C) 2022-2024 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##
name: "ZXF: Deploy Production Release"
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+-?*"
workflow_dispatch:
inputs:
ref:
required: true
description: "The github branch or tag that triggered the workflow"
author:
required: false
description: "The author of the commit"
default: ""
msg:
required: false
description: "The message on the head commit"
default: ""
sha:
required: false
description: "The commit ID of the commit that triggered the workflow"
default: ""
defaults:
run:
shell: bash
jobs:
prepare-tag-release:
name: Prepare Release [Tag]
runs-on: network-node-linux-medium
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
outputs:
version: ${{ steps.tag.outputs.version }}
prerelease: ${{ steps.tag.outputs.prerelease }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Install Semantic Version Tools
run: |
echo "::group::Download SemVer Binary"
sudo curl -L -o /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
echo "::endgroup::"
echo "::group::Change SemVer Binary Permissions"
sudo chmod -v +x /usr/local/bin/semver
echo "::endgroup::"
echo "::group::Show SemVer Binary Version Info"
semver --version
echo "::endgroup::"
- name: Extract Tag Version
id: tag
run: |
RELEASE_VERSION="$(semver get release "${{ github.ref_name }}")"
PRERELEASE_VERSION="$(semver get prerel "${{ github.ref_name }}")"
FINAL_VERSION="${RELEASE_VERSION}"
PRERELEASE_FLAG="false"
[[ -n "${PRERELEASE_VERSION}" ]] && FINAL_VERSION="${RELEASE_VERSION}-${PRERELEASE_VERSION}"
[[ -n "${PRERELEASE_VERSION}" ]] && PRERELEASE_FLAG="true"
echo "version=${FINAL_VERSION}" >>"${GITHUB_OUTPUT}"
echo "prerelease=${PRERELEASE_FLAG}" >>"${GITHUB_OUTPUT}"
release-tag:
name: Release [Tag]
uses: ./.github/workflows/node-zxc-build-release-artifact.yaml
needs:
- prepare-tag-release
with:
version-policy: specified
new-version: ${{ needs.prepare-tag-release.outputs.version }}
trigger-env-deploy: none
release-profile: ${{ needs.prepare-tag-release.outputs.prerelease == 'true' && 'PrereleaseChannel' || 'MavenCentral' }}
secrets:
access-token: ${{ secrets.GITHUB_TOKEN }}
bucket-name: ${{ secrets.RELEASE_ARTIFACT_BUCKET_NAME }}
cdn-bucket-name: ${{ secrets.CDN_ARTIFACT_BUCKET_NAME }}
svcs-ossrh-username: ${{ secrets.SVCS_OSSRH_USERNAME }}
svcs-ossrh-password: ${{ secrets.SVCS_OSSRH_PASSWORD }}
svcs-gpg-key-contents: ${{ secrets.SVCS_GPG_KEY_CONTENTS }}
svcs-gpg-key-passphrase: ${{ secrets.SVCS_GPG_KEY_PASSPHRASE }}
sdk-ossrh-username: ${{ secrets.PLATFORM_OSSRH_USERNAME }}
sdk-ossrh-password: ${{ secrets.PLATFORM_OSSRH_PASSWORD }}
sdk-gpg-key-contents: ${{ secrets.PLATFORM_GPG_KEY_CONTENTS }}
sdk-gpg-key-passphrase: ${{ secrets.PLATFORM_GPG_KEY_PASSPHRASE }}
slack-webhook-url: ${{ secrets.PLATFORM_SLACK_RELEASE_WEBHOOK }}
jf-url: ${{ vars.JF_URL }}
jf-docker-registry: ${{ vars.JF_DOCKER_REGISTRY }}
jf-user-name: ${{ vars.JF_USER_NAME }}
jf-access-token: ${{ secrets.JF_ACCESS_TOKEN }}
release-branch:
name: Release [Branch]
uses: ./.github/workflows/node-zxc-build-release-artifact.yaml
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
version-policy: branch-commit
trigger-env-deploy: integration
release-profile: DevelopCommit
secrets:
access-token: ${{ secrets.GITHUB_TOKEN }}
bucket-name: ${{ secrets.RELEASE_ARTIFACT_BUCKET_NAME }}
cdn-bucket-name: ${{ secrets.CDN_ARTIFACT_BUCKET_NAME }}
svcs-ossrh-username: ${{ secrets.SVCS_OSSRH_USERNAME }}
svcs-ossrh-password: ${{ secrets.SVCS_OSSRH_PASSWORD }}
svcs-gpg-key-contents: ${{ secrets.SVCS_GPG_KEY_CONTENTS }}
svcs-gpg-key-passphrase: ${{ secrets.SVCS_GPG_KEY_PASSPHRASE }}
sdk-ossrh-username: ${{ secrets.PLATFORM_OSSRH_USERNAME }}
sdk-ossrh-password: ${{ secrets.PLATFORM_OSSRH_PASSWORD }}
sdk-gpg-key-contents: ${{ secrets.PLATFORM_GPG_KEY_CONTENTS }}
sdk-gpg-key-passphrase: ${{ secrets.PLATFORM_GPG_KEY_PASSPHRASE }}
slack-webhook-url: ${{ secrets.PLATFORM_SLACK_RELEASE_WEBHOOK }}
jf-url: ${{ vars.JF_URL }}
jf-docker-registry: ${{ vars.JF_DOCKER_REGISTRY }}
jf-user-name: ${{ vars.JF_USER_NAME }}
jf-access-token: ${{ secrets.JF_ACCESS_TOKEN }}
deploy-ci-trigger:
name: Trigger CI Flows
runs-on: network-node-linux-medium
needs:
- release-branch
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
ref: develop
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Trigger ZXF Prepare Extended Test Suite
if: ${{ needs.release-branch.result == 'success' }}
uses: step-security/workflow-dispatch@4d1049025980f72b1327cbfdeecb07fe7a20f577 # v1.2.4
with:
workflow: .github/workflows/zxf-prepare-extended-test-suite.yaml
repo: hashgraph/hedera-services # ensure we are executing in the hashgraph org
ref: develop # ensure we are always using the workflow definition from the develop branch
token: ${{ secrets.GH_ACCESS_TOKEN }}
inputs: '{ "ref": "${{ inputs.ref }}" }'
- name: Trigger ZXF Deploy Integration
if: ${{ needs.release-branch.result == 'success' &&
(inputs.author != '' && inputs.msg != '' && inputs.sha != '') &&
!cancelled() }}
uses: step-security/workflow-dispatch@4d1049025980f72b1327cbfdeecb07fe7a20f577 # v1.2.4
with:
workflow: .github/workflows/node-zxf-deploy-integration.yaml
repo: hashgraph/hedera-services # ensure we are executing in the hashgraph org
ref: develop # ensure we are always using the workflow definition from the develop branch
token: ${{ secrets.GH_ACCESS_TOKEN }}
inputs: '{
"ref": "${{ inputs.ref }}",
"author": "${{ inputs.author }}",
"msg": "${{ inputs.msg }}",
"sha": "${{ inputs.sha }}"
}'
update-hedera-protobufs:
name: Update Hedera Protobufs
runs-on: network-node-linux-medium
needs:
- prepare-tag-release
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout Hedera Services Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
ref: develop
fetch-depth: '0'
- name: Checkout Hedera Protobufs Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
fetch-depth: '0'
repository: hashgraph/hedera-protobufs
path: hedera-protobufs
- name: Install rsync
run: sudo apt update && sudo apt -y install rsync
- name: Update the folders owned by Services
working-directory: hedera-protobufs
run: |
git push --delete origin v${{ needs.prepare-tag-release.outputs.version }} || true
git tag --delete v${{ needs.prepare-tag-release.outputs.version }} || true
rsync -a --delete ../hapi/hedera-protobufs/services/ services/
- name: Import GPG key for commit signoff
id: gpg_import
uses: step-security/ghaction-import-gpg@6c8fe4d0126a59d57c21f87c9ae5dd3451fa3cca # v6.1.0
with:
gpg_private_key: ${{ secrets.SVCS_GPG_KEY_CONTENTS }}
passphrase: ${{ secrets.SVCS_GPG_KEY_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Add & Commit
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
with:
cwd: 'hedera-protobufs'
author_name: swirlds-eng-automation
author_email: ${{ secrets.SVCS_GIT_USER_EMAIL }}
commit: --signoff
message: "ci: Copied recent protobuf changes from hedera-services"
new_branch: "update-recent-protobuf-changes-${{ github.run_number }}"
tag: 'v${{ needs.prepare-tag-release.outputs.version }} -s -m "Hedera Protobufs v${{ needs.prepare-tag-release.outputs.version }}" -u "${{ steps.gpg_import.outputs.keyid }}"'