-
Notifications
You must be signed in to change notification settings - Fork 7
179 lines (160 loc) · 5.53 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
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
name: Build and publish
on:
pull_request:
types: [closed]
branches:
- master
- develop
- beta
- stable
- 'v*.*.*'
jobs:
create_release:
if: github.event.pull_request.merged
name: Create release
runs-on: ubuntu-20.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.export_outputs.outputs.version }}
branch: ${{ steps.export_outputs.outputs.branch }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
- name: Checkout submodules
run: git submodule update --init
- name: Install ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install python-setuptools
- name: Set Versions
run: |
bash ./scripts/set_versions_ga.sh
- name: Set release
run: |
if [[ "$BRANCH" == "stable" ]]; then
export PRERELEASE=false
else
export PRERELEASE=true
fi
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
draft: false
prerelease: ${{ env.PRERELEASE }}
- name: Export outputs
id: export_outputs
run: |
echo "::set-output name=version::$VERSION"
echo "::set-output name=branch::$BRANCH"
build_and_publish_normal:
if: github.event.pull_request.merged
needs: create_release
name: Build and publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
asset_name: skale-${{ needs.create_release.outputs.version }}-Linux-x86_64
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.11
- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
- name: Checkout submodules
run: git submodule update --init
- name: Build normal binary
run: |
mkdir -p ./dist
docker build . -t node-cli-builder
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder scripts/build.sh ${{ needs.create_release.outputs.version }} ${{ needs.create_release.outputs.branch }} normal
ls -altr /home/ubuntu/dist/
docker rm -f $(docker ps -aq)
- name: Save sha512sum
run: |
sudo sha512sum /home/ubuntu/dist/${{ matrix.asset_name }} | sudo tee > /dev/null /home/ubuntu/dist/sha512sum
- name: Upload release binary
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /home/ubuntu/dist/${{ matrix.asset_name }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream
- name: Upload release checksum
id: upload-release-checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /home/ubuntu/dist/sha512sum
asset_name: ${{ matrix.asset_name }}.sha512
asset_content_type: text/plain
build_and_publish_sync:
if: github.event.pull_request.merged
needs: create_release
name: Build and publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
asset_name: skale-${{ needs.create_release.outputs.version }}-Linux-x86_64-sync
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.11
- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
- name: Checkout submodules
run: git submodule update --init
- name: Build sync release binary
run: |
mkdir -p ./dist
docker build . -t node-cli-builder
docker run -v /home/ubuntu/dist:/app/dist node-cli-builder scripts/build.sh ${{ needs.create_release.outputs.version }} ${{ needs.create_release.outputs.branch }} sync
ls -altr /home/ubuntu/dist/
docker rm -f $(docker ps -aq)
- name: Save sha512sum
run: |
sudo sha512sum /home/ubuntu/dist/${{ matrix.asset_name }} | sudo tee > /dev/null /home/ubuntu/dist/sha512sum
- name: Upload release sync CLI
id: upload-sync-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /home/ubuntu/dist/${{ matrix.asset_name }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream
- name: Upload release sync CLI checksum
id: upload-sync-release-checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /home/ubuntu/dist/sha512sum
asset_name: ${{ matrix.asset_name }}.sha512
asset_content_type: text/plain