-
Notifications
You must be signed in to change notification settings - Fork 3
143 lines (118 loc) · 4.31 KB
/
pre-release-types-rollup-solochain.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Pre-release types rollup solochain
on:
push:
branches:
- 'rc/types/*'
- 'feat/add-support-for-solochain-MGX-1001'
# TODO: put back before closing PR
# paths:
# - packages/types/**
workflow_dispatch:
inputs:
parachainDocker:
description: "Name of the parachain docker reference"
type: string
required: false
default: "mangatasolutions/rollup-node:53c527a67582de8b7099d76d86c44c200e053f2b"
branch:
description: "Branch where to make pre release"
type: string
required: false
default: ""
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
API_URL: "ws://127.0.0.1:9947"
permissions:
contents: write
id-token: write
deployments: write
checks: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: nrwl/nx-set-shas@v4
- name: Clone mangata node repository with branch
if: ${{ github.event.inputs.branch != '' }}
uses: actions/checkout@v4
with:
repository: mangata-finance/mangata-node
path: mangata-repo
ref: ${{ github.event.inputs.branch }}
- name: Clone mangata node repository `eth-rollup-develop`
if: ${{ github.event.inputs.branch == '' }}
uses: actions/checkout@v4
with:
repository: mangata-finance/mangata-node
path: mangata-repo
#TODO change after finishing
# ref: eth-rollup-develop
ref: ci/eth-develop-solochain-workflow-updates-MGX-1001
- name: Setup Node version and cache dependencies
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
- name: Install WASM toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: wasm32-unknown-unknown
- name: Install websocat
run: cargo install websocat
- name: Run the Node
working-directory: mangata-repo
run: |
export NODE_IMAGE=${{ github.event.inputs.parachainDocker }}
docker-compose up -d
docker ps
- name: Sleep for 1 minutes
run: sleep 60s
- run: npm i
- name: Generate metadata
if: ${{ github.event.inputs.branch != '' }}
run: npx nx run @mangata-finance/types:generate-metadata
- name: Build types
if: ${{ github.event.inputs.branch != '' }}
run: npx nx run @mangata-finance/types:build-types
- run: npx nx run @mangata-finance/types:lint
- name: NPM version bump
if: ${{ github.event.inputs.branch != '' }}
working-directory: packages/types
env:
INPUTS_BRANCH: ${{ github.event.inputs.branch }}
run: |
# Branch name sanitization added to avoid issues with npm version command
# Example `ci/new-branch-1.0.0` -> `ci-new-branch-1-0-0`
npm version prerelease --preid="$(echo "${INPUTS_BRANCH}" | sed -E 's@[/\.]@-@g; s@_@-@g')"
- name: git add and commit new version
if: ${{ github.event.inputs.branch != '' }}
run: |
git config user.name mangatafinance
git config user.email solutions@mangata.finance
git add .
git commit -m "chore: updated to new prerelease version"
git push
- name: Build
if: ${{ github.event.inputs.branch != '' }}
run: npx nx run @mangata-finance/types:build
- name: Publish to NPM
if: ${{ github.event.inputs.branch != '' }}
working-directory: dist/packages/types
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
INPUTS_BRANCH: ${{ github.event.inputs.branch }}
run: |
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
# Branch name sanitization added to avoid issues with npm version command
# Example `ci/new-branch-1.0.0` -> `ci-new-branch-1-0-0`
npm publish --tag "$(echo "${INPUTS_BRANCH}" | sed -E 's@[/\.]@-@g; s@_@-@g')" --access public
- name: Publish rc to NPM
if: ${{ github.event.inputs.branch == '' }}
run: npx nx run @mangata-finance/types:semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}