-
Notifications
You must be signed in to change notification settings - Fork 11
227 lines (207 loc) · 8.54 KB
/
build-master.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: Build master
on:
push:
branches:
- 'master'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
check_source:
name: "Run code checks"
uses: ./.github/workflows/_shared-check.yaml
build_binaries:
name: "Build Assertoor"
needs: [check_source]
uses: ./.github/workflows/_shared-build.yaml
with:
ref: ${{ github.sha }}
release: "snapshot"
docker: true
docker_repository: "ethpandaops/assertoor"
docker_tag_prefix: "master"
additional_tags: "['master','master-latest']"
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
update_project_wiki:
name: Generate project documentation
needs: [check_source]
runs-on: ubuntu-latest
steps:
- name: Checkout base code
uses: actions/checkout@v2
with:
path: code
- name: Checkout wiki code
uses: actions/checkout@v2
with:
repository: ${{github.repository}}.wiki
path: wiki
- name: Generate wiki from docs
run: |
touch ./wiki.md
for filename in code/docs/*.md; do
while IFS= read -r line; do
if [[ "$line" =~ ^"#!!" ]]; then
bash -c "cd code && ${line:3}" >> ./wiki.md
else
echo "$line" >> ./wiki.md
fi
done <<< $(cat $filename)
echo "" >> ./wiki.md
done
cp ./wiki.md ./wiki/Home.md
- name: Push to wiki
run: |
cd wiki
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git diff-index --quiet HEAD || git commit -m "Add changes" && git push
create_snapshot_release:
name: Create snapshot release
needs: [build_binaries]
runs-on: ubuntu-latest
steps:
# download build artifacts
- name: "Download build artifacts"
uses: actions/download-artifact@v3
# (re)create snapshot binary release
- name: Update snapshot tag & remove previous snapshot release
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
try {
var snapshotTag = "snapshot";
var snapshotRelease = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: snapshotTag
});
if(snapshotRelease && snapshotRelease.data && snapshotRelease.data.tag_name == snapshotTag) {
console.log("delete previous snapshot release");
await github.repos.deleteRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: snapshotRelease.data.id
});
}
var snapshotRef = await github.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/" + snapshotTag
});
if(snapshotRef && snapshotRef.data && snapshotRef.data.ref) {
if(snapshotRef.data.object.sha !== context.sha) {
await github.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/" + snapshotTag,
sha: context.sha,
});
}
}
else {
await github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/" + snapshotTag,
sha: context.sha,
});
}
} catch (e) {
console.log(e)
}
- name: Create snapshot release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: true
release_name: "Dev Snapshot"
tag_name: "snapshot"
body: |
## Latest automatically built executables. (Unstable development snapshot)
Built from master branch (commit: ${{ github.sha }})
Please read the [wiki](https://github.com/ethpandaops/assertoor/wiki) for setup / configuration instructions.
### Release Artifacts
| Release File | Description |
| ------------- | ------------- |
| [assertoor_snapshot_windows_amd64.zip](https://github.com/ethpandaops/assertoor/releases/download/snapshot/assertoor_snapshot_windows_amd64.zip) | assertoor executables for windows/amd64 |
| [assertoor_snapshot_linux_amd64.tar.gz](https://github.com/ethpandaops/assertoor/releases/download/snapshot/assertoor_snapshot_linux_amd64.tar.gz) | assertoor executables for linux/amd64 |
| [assertoor_snapshot_linux_arm64.tar.gz](https://github.com/ethpandaops/assertoor/releases/download/snapshot/assertoor_snapshot_linux_arm64.tar.gz) | assertoor executables for linux/arm64 |
| [assertoor_snapshot_darwin_amd64.tar.gz](https://github.com/ethpandaops/assertoor/releases/download/snapshot/assertoor_snapshot_darwin_amd64.tar.gz) | assertoor executable for macos/amd64 |
| [assertoor_snapshot_darwin_arm64.tar.gz](https://github.com/ethpandaops/assertoor/releases/download/snapshot/assertoor_snapshot_darwin_arm64.tar.gz) | assertoor executable for macos/arm64 |
env:
GITHUB_TOKEN: ${{ github.token }}
# generate & upload release artifacts
- name: "Generate release package: assertoor_snapshot_windows_amd64.zip"
run: |
cd assertoor_windows_amd64
zip -r -q ../assertoor_snapshot_windows_amd64.zip .
- name: "Upload snapshot release artifact: assertoor_snapshot_windows_amd64.zip"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./assertoor_snapshot_windows_amd64.zip
asset_name: assertoor_snapshot_windows_amd64.zip
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Generate release package: assertoor_snapshot_linux_amd64.tar.gz"
run: |
cd assertoor_linux_amd64
tar -czf ../assertoor_snapshot_linux_amd64.tar.gz .
- name: "Upload snapshot release artifact: assertoor_snapshot_linux_amd64.tar.gz"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./assertoor_snapshot_linux_amd64.tar.gz
asset_name: assertoor_snapshot_linux_amd64.tar.gz
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Generate release package: assertoor_snapshot_linux_arm64.tar.gz"
run: |
cd assertoor_linux_arm64
tar -czf ../assertoor_snapshot_linux_arm64.tar.gz .
- name: "Upload snapshot release artifact: assertoor_snapshot_linux_arm64.tar.gz"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./assertoor_snapshot_linux_arm64.tar.gz
asset_name: assertoor_snapshot_linux_arm64.tar.gz
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Generate release package: assertoor_snapshot_darwin_amd64.tar.gz"
run: |
cd assertoor_darwin_amd64
tar -czf ../assertoor_snapshot_darwin_amd64.tar.gz .
- name: "Upload snapshot release artifact: assertoor_snapshot_darwin_amd64.tar.gz"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./assertoor_snapshot_darwin_amd64.tar.gz
asset_name: assertoor_snapshot_darwin_amd64.tar.gz
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Generate release package: assertoor_snapshot_darwin_arm64.tar.gz"
run: |
cd assertoor_darwin_arm64
tar -czf ../assertoor_snapshot_darwin_arm64.tar.gz .
- name: "Upload snapshot release artifact: assertoor_snapshot_darwin_arm64.tar.gz"
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./assertoor_snapshot_darwin_arm64.tar.gz
asset_name: assertoor_snapshot_darwin_arm64.tar.gz
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ github.token }}