-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (100 loc) · 2.91 KB
/
subql-release.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
name: Release Subql
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
SUBQL_ACCESS_TOKEN: ${{ secrets.SUBQUERY_TOKEN }}
DOCKER_REGISTRY: ghcr.io
jobs:
publish-subql:
name: Build subql
runs-on: ubuntu-latest
strategy:
max-parallel: 8
matrix:
package:
- apps
- bridger
chain:
- darwinia
- crab
- pangolin
- pangoro
- kusama
- polkadot
- rococo
- moonbase
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Detect if build is required
id: detect-build
working-directory: subql
run: |
BASE_PATH=$(pwd)
PACKAGE=${{ matrix.package }}
CHAIN=${{ matrix.chain }}
FILE_PROJECt_CHAIN_MAPPING=${BASE_PATH}/../.maintain/subql-project-chain.json
CHAINS=$(jq -r ".${PACKAGE} | .[]" $FILE_PROJECt_CHAIN_MAPPING)
ALLOW=false
for ALLOW_CHAIN in ${CHAINS}; do
if [ "${CHAIN}" == "${ALLOW_CHAIN}" ]; then
ALLOW=true
fi
done
echo "::set-output name=ALLOW::$ALLOW"
- name: Install deps
working-directory: subql
if: steps.detect-build.outputs.ALLOW == 'true'
run: |
yarn install
yarn boot
- name: Build and push
working-directory: subql
if: steps.detect-build.outputs.ALLOW == 'true'
run: |
BASE_PATH=$(pwd)
yarn run build:common
yarn run build:${{ matrix.package }} -- ${{ matrix.chain }}
rm -rf common/node_modules
rm -rf packages/${{ matrix.package }}/node_modules/@darwinia/index-common
mv common packages/${{ matrix.package }}/node_modules/@darwinia/index-common
cd packages/${{ matrix.package }}
yarn run publish -- ${{ matrix.chain }}
- name: Collect ipfs cid
if: steps.detect-build.outputs.ALLOW == 'true'
run: |
mkdir -p shared/${{ matrix.package }}
cp subql/packages/${{ matrix.package }}/.project-cid shared/${{ matrix.package }}/${{ matrix.chain }}.cid
- name: Upload shared
uses: actions/upload-artifact@v2
if: steps.detect-build.outputs.ALLOW == 'true'
with:
name: index-artifact
path: shared
complete-publish:
name: Complete publish
runs-on: ubuntu-latest
needs: [ publish-subql ]
steps:
- uses: actions/download-artifact@v2
with:
name: index-artifact
path: shared
- name: Show ipfs cid
run: |
cd shared
tail -n +1 */*
clean-artifacts:
name: Clean artifacts
runs-on: ubuntu-latest
needs: [ complete-publish ]
if: always()
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: index-artifact