forked from DeFiCh/ain
-
Notifications
You must be signed in to change notification settings - Fork 0
189 lines (159 loc) · 7.11 KB
/
release-builds.yaml
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
180
181
182
183
184
185
186
187
188
189
name: Release Build
on:
release:
types: [published]
jobs:
linux:
runs-on: ubuntu-18.04
env:
BUILD_VERSION: latest # Computed
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build and package
run: ./make.sh docker-release-git
- name: Publish artifacts
uses: actions/upload-artifact@v3
with:
name: defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu
path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz
# Linux build additionally pushes the docker images to docker hub on successful build
- name: Tag dockerhub build
if: ${{ github.repository == 'DeFiCh/ain' }}
run: >
docker tag defichain-x86_64-pc-linux-gnu:${{ env.BUILD_VERSION }}
defichain-x86_64-pc-linux-gnu:dockerhub-latest
- uses: docker/build-push-action@v1
# Make sure to only build on ain repo. Also add in additional restrictions here if needed to
# make sure we don't push unnecessary images to docker
if: ${{ github.repository == 'DeFiCh/ain' }}
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
path: ./contrib/dockerfiles/dockerhub
dockerfile: ./contrib/dockerfiles/dockerhub/x86_64-pc-linux-gnu.dockerfile
repository: defi/defichain
tags: latest,${{ env.BUILD_VERSION }}
windows:
runs-on: ubuntu-18.04
env:
BUILD_VERSION: latest # Computed
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Build and package
run: TARGET="x86_64-w64-mingw32" ./make.sh docker-release-git
- name: Publish artifact - x86_64-w64-mingw32
uses: actions/upload-artifact@v3
with:
name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32
path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.tar.gz
macos:
runs-on: ubuntu-18.04
env:
BUILD_VERSION: latest # Computed
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Build and package
run: TARGET="x86_64-apple-darwin18" ./make.sh docker-release-git
- name: Publish artifact - x86_64-apple-darwin18
uses: actions/upload-artifact@v3
with:
name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18
path: ./build/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18.tar.gz
create-release:
needs:
- linux
- windows
- macos
runs-on: ubuntu-18.04
env:
BUILD_VERSION: latest # Computed
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: compute build version
run: ./make.sh git-version
- name: cleanup work dir
run: rm -rf *
- name: get all build artifacts
uses: actions/download-artifact@v3
- name: zip package for windows
run: |
set -e
cd defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32
tar xzf defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.tar.gz
zip -r "defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.zip" \
defichain-${{ env.BUILD_VERSION }}/
- name: Get Release by Tag
id: get_release_by_tag
uses: jonfriesen/get-release-by-tag@77560d8bbb6096f823ca949d556a1e48c0a60cd0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.BUILD_VERSION }}
- name: Generate SHA256 checksum
run: |
cd ./defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu
sha256sum ./defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz > ./defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz.SHA256
cd .. && cd ./defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32
sha256sum ./defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.zip > ./defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.zip.SHA256
cd .. && cd ./defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18
sha256sum ./defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18.tar.gz > ././defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18.tar.gz.SHA256
- name: Upload release asset - linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }}
asset_path: ./defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu/defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz
asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz
asset_content_type: application/gzip
- name: Upload checksum - linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }}
asset_path: ./defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu/defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz.SHA256
asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-pc-linux-gnu.tar.gz.SHA256
asset_content_type: text/plain
- name: Upload release asset - windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }}
asset_path: ./defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32/defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.zip
asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.zip
asset_content_type: application/zip
- name: Upload checksum asset - windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }}
asset_path: ./defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32/defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.zip.SHA256
asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-w64-mingw32.zip.SHA256
asset_content_type: text/plain
- name: Upload release asset - macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }}
asset_path: ./defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18.tar.gz
asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18.tar.gz
asset_content_type: application/gzip
- name: Upload checksum asset - macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }}
asset_path: ./defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18/defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18.tar.gz.SHA256
asset_name: defichain-${{ env.BUILD_VERSION }}-x86_64-apple-darwin18.tar.gz.SHA256
asset_content_type: text/plain