-
Notifications
You must be signed in to change notification settings - Fork 12
95 lines (77 loc) · 2.07 KB
/
publish.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
# cspell:words ncipollo
name: Publish
on:
pull_request:
types: [closed]
branches:
- 'v*.*.*'
- develop
- beta
- release-candidate
- stable
push:
tags:
- 'custom-release-*'
env:
NODE_VERSION: 20
jobs:
build:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.merged == true
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install NODE JS
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Install project
run: yarn install
- name: Calculate version
id: version
run: |
export BRANCH=${GITHUB_REF##*/}
echo "Branch $BRANCH"
export VERSION=$(bash ./scripts/calculate_version.sh)
echo "Version $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
( test $BRANCH = "stable" || test $BRANCH = "master" && export PRERELEASE=false ) || export PRERELEASE=true
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
- name: Generate ABI
run: yarn exec hardhat run scripts/generateAbi.ts
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: data
path: data
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
prerelease: ${{ env.PRERELEASE }}
artifacts: "data/*-abi.json"
abi:
runs-on: ubuntu-latest
needs:
build
env:
VERSION: ${{ needs.build.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
ref: abi
- name: Load artifacts
uses: actions/download-artifact@v4
with:
name: data
- name: Commit ABI
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Add ABI for version ${{ env.VERSION }}"
add: "*-abi.json"