-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (71 loc) · 2.87 KB
/
node.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
name: Release node
on:
workflow_dispatch:
inputs:
network:
description: "Network"
required: true
type: choice
options:
- darwinia
- crab
- pangolin
tag:
description: "Release tag"
type: string
env:
ARTIFACT_LINK_PREFIX: https://github.com/darwinia-network/darwinia/releases/download
jobs:
release-node:
name: Release ${{ github.event.inputs.network }} node
runs-on: ubuntu-latest
steps:
- name: Prepare artifacts
run: |
mkdir artifacts
curl -fLO ${{ env.ARTIFACT_LINK_PREFIX }}/${{ github.event.inputs.tag }}/darwinia-x86_64-linux-gnu.tar.bz2
curl -fLO ${{ env.ARTIFACT_LINK_PREFIX }}/${{ github.event.inputs.tag }}/darwinia-x86_64-linux-gnu.tar.zst
mv darwinia-x86_64-linux-gnu.tar.* artifacts/
- name: Publish
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/*
prerelease: ${{ startsWith(github.event.inputs.tag, 'pango') }}
tag_name: ${{ github.event.inputs.network }}-${{ github.event.inputs.tag }}
target_commitish: ${{ github.event.inputs.network }}
token: ${{ secrets.GITHUB_TOKEN }}
deploy-node:
name: Deploy ${{ github.event.inputs.network }} node
runs-on: ubuntu-latest
steps:
- name: Deploy tracing nodes
run: |
GITHUB_TOKEN=${{ secrets.GH_TKN_DARWINIA }} gh workflow run \
trigger-tracing-node.yml \
--ref=main \
--repo=darwinia-network/devops \
--raw-field=network=${{ github.event.inputs.network }} \
--raw-field="version=${{ github.event.inputs.tag }}"
- name: Deploy pangolin nodes
if: ${{ github.event.inputs.network == 'pangolin' }}
run: |
MESSAGE='${{ github.event.head_commit.message }}'
DOCKER_IMAGE_TAG=ghcr.io/darwinia-network/darwinia:${{ github.event.inputs.tag }}
jq -n \
--arg file playbooks/pangolin_nodes/host_vars/g1.testnets \
--arg key .substrate_node_runner.node.image \
--arg value ${DOCKER_IMAGE_TAG} \
'{file: $file, key: $key, value: $value}' >> /tmp/changes.json
jq -n \
--arg file playbooks/pangolin_nodes/host_vars/g2.testnets \
--arg key .substrate_node_runner.node.image \
--arg value ${DOCKER_IMAGE_TAG} \
'{file: $file, key: $key, value: $value}' >> /tmp/changes.json
MULTI_CHANGES=$(jq -crs '.' < /tmp/changes.json)
GITHUB_TOKEN=${{ secrets.GH_TKN_DARWINIA }} gh workflow run \
trigger.yml \
--ref=main \
--repo=darwinia-network/ansible-playbooks \
--raw-field="changes=${MULTI_CHANGES}" \
--raw-field="message=[darwinia-release]: [deploy-${{ github.event.inputs.network }}] ${MESSAGE}"