Skip to content
55 changes: 55 additions & 0 deletions .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build binaries

on:
workflow_dispatch:
inputs:
version:
required: true
type: string
workflow_call:
inputs:
version:
required: true
type: string

jobs:
binaries:
name: Build lodestar binaries
strategy:
matrix:
include:
- os: ubuntu-latest
build: |
npx caxa -e "dashboards/**" -e "docs/**" -D -p "yarn install --production" --input . --output "lodestar" -- "{{caxa}}/node_modules/.bin/node" "--max-old-space-size=8192" "{{caxa}}/node_modules/.bin/lodestar"
tar -czf "dist/lodestar-${{ inputs.version }}-linux-amd64.tgz" "lodestar"
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
- run: |
mkdir -p dist
yarn global add caxa@3.0.1
${{ matrix.build }}
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}
path: dist/
if-no-files-found: error
- name: Sanity check binary
uses: actions/github-script@v7
with:
script: |
exec.exec('./lodestar dev');
await new Promise(resolve => setTimeout(resolve, 30000));
const resp = await fetch('http://127.0.0.1:9596/eth/v1/node/version').catch(err => {
core.setFailed(`Error accessing the API ${err}`);
process.exit(1);
});
if (resp.status !== 200) {
core.setFailed(`Failed to access API: ${resp.status}`);
process.exit(1);
}
process.exit(0);
17 changes: 16 additions & 1 deletion .github/workflows/publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
npm:
name: Publish to NPM & Github
runs-on: buildjet-4vcpu-ubuntu-2204
needs: tag
needs: [tag, binaries]
if: needs.tag.outputs.is_stable == 'true'
steps:
- uses: actions/checkout@v4
Expand All @@ -65,12 +65,20 @@ jobs:
- name: Generate changelog
run: node scripts/generate_changelog.mjs ${{ needs.tag.outputs.prev_tag }} ${{ needs.tag.outputs.tag }} CHANGELOG.md

- name: Get binaries
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
fail_on_unmatched_files: true
tag_name: ${{ needs.tag.outputs.tag }}
body_path: "CHANGELOG.md"
name: Release ${{ needs.tag.outputs.tag }}
Expand Down Expand Up @@ -152,3 +160,10 @@ jobs:
--file ./docker/prometheus/Dockerfile
--tag chainsafe/lodestar-prometheus:${{ needs.tag.outputs.tag }}
--platform linux/amd64,linux/arm64

binaries:
name: Build lodestar binaries
uses: ./.github/workflows/binaries.yml
needs: tag
with:
version: ${{ needs.tag.outputs.tag }}