Skip to content

Commit 2649a87

Browse files
jeluardnflaig
andauthored
feat: add lodestar binaries to release (#6666)
* feat: added binaries creation support * feat: added sanity checks * chore: define reusable workflow * chore: fix sanity check,; disable arm64 * chore: added workflow_dispatch * fix: needs cleanup * chore: update old space size Co-authored-by: Nico Flaig <nflaig@protonmail.com> * chore: address comments * chore: address comments * chore: fixed typo * chore: typo Co-authored-by: Nico Flaig <nflaig@protonmail.com> * chore: address comments * chore: wording Co-authored-by: Nico Flaig <nflaig@protonmail.com> * chore: use frozen lock file Co-authored-by: Nico Flaig <nflaig@protonmail.com> --------- Co-authored-by: Nico Flaig <nflaig@protonmail.com>
1 parent fd2fb16 commit 2649a87

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

.github/workflows/binaries.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build binaries
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
required: true
8+
type: string
9+
workflow_call:
10+
inputs:
11+
version:
12+
required: true
13+
type: string
14+
15+
jobs:
16+
binaries:
17+
name: Build lodestar binaries
18+
strategy:
19+
matrix:
20+
include:
21+
- os: ubuntu-latest
22+
build: |
23+
npx caxa -m "Unpacking Lodestar binary, please wait..." -e "dashboards/**" -e "docs/**" -D -p "yarn install --frozen-lockfile --production" --input . --output "lodestar" -- "{{caxa}}/node_modules/.bin/node" "--max-old-space-size=8192" "{{caxa}}/node_modules/.bin/lodestar"
24+
tar -czf "dist/lodestar-${{ inputs.version }}-linux-amd64.tar.gz" "lodestar"
25+
runs-on: ${{matrix.os}}
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: "./.github/actions/setup-and-build"
29+
with:
30+
node: 20
31+
- run: |
32+
mkdir -p dist
33+
yarn global add caxa@3.0.1
34+
${{ matrix.build }}
35+
- name: Upload binaries
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: binaries-${{ matrix.os }}
39+
path: dist/
40+
if-no-files-found: error
41+
- name: Sanity check binary
42+
uses: actions/github-script@v7
43+
with:
44+
script: |
45+
exec.exec('./lodestar dev');
46+
await new Promise(resolve => setTimeout(resolve, 30000));
47+
const resp = await fetch('http://127.0.0.1:9596/eth/v1/node/version').catch(err => {
48+
core.setFailed(`Error accessing the API ${err}`);
49+
process.exit(1);
50+
});
51+
if (resp.status !== 200) {
52+
core.setFailed(`Failed to access API: ${resp.status}`);
53+
process.exit(1);
54+
}
55+
process.exit(0);

.github/workflows/publish-stable.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,17 @@ jobs:
4848
tag: ${{ steps.get_tag.outputs.tag }}
4949
prev_tag: ${{ steps.get_prev_tag.outputs.prev_tag }}
5050

51+
binaries:
52+
name: Build lodestar binaries
53+
uses: ./.github/workflows/binaries.yml
54+
needs: tag
55+
with:
56+
version: ${{ needs.tag.outputs.tag }}
57+
5158
npm:
5259
name: Publish to NPM & Github
5360
runs-on: buildjet-4vcpu-ubuntu-2204
54-
needs: tag
61+
needs: [tag, binaries]
5562
if: needs.tag.outputs.is_stable == 'true'
5663
steps:
5764
- uses: actions/checkout@v4
@@ -65,12 +72,20 @@ jobs:
6572
- name: Generate changelog
6673
run: node scripts/generate_changelog.mjs ${{ needs.tag.outputs.prev_tag }} ${{ needs.tag.outputs.tag }} CHANGELOG.md
6774

75+
- name: Get binaries
76+
uses: actions/download-artifact@v4
77+
with:
78+
path: dist/
79+
merge-multiple: true
80+
6881
- name: Create Release
6982
id: create_release
7083
uses: softprops/action-gh-release@v2
7184
env:
7285
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7386
with:
87+
files: dist/*
88+
fail_on_unmatched_files: true
7489
tag_name: ${{ needs.tag.outputs.tag }}
7590
body_path: "CHANGELOG.md"
7691
name: Release ${{ needs.tag.outputs.tag }}

0 commit comments

Comments
 (0)