Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add release pipeline: builds, verifies BITCOIN_DA_ID, releases binary #1000

Merged
merged 5 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: release

on:
push:
tags:
- "v*.*.*"

env:
EXPECTED_BITCOIN_DA_ID: ${{ vars.EXPECTED_BITCOIN_DA_ID }}

jobs:

build-and-push:
runs-on: ubicloud-standard-30
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: false
load: true
tags: citrea-builder-image
platforms: linux/amd64

- name: Run and check image
id: check-image
run: |
echo "Starting container..."
docker run -d --name citrea-builder-container --entrypoint /bin/sh citrea-builder-image -c "while true; do sleep 30; done"

echo "Checking BITCOIN_DA_ID..."
RESULT=$(docker exec citrea-builder-container grep -R "${{ env.EXPECTED_BITCOIN_DA_ID }}" /citrea || echo "Grep failed")
echo "Grep result: $RESULT"

echo "Extracting release binary..."
mkdir -p release
docker cp citrea-builder-container:/citrea/target/release/citrea release/

sudo apt-get update && sudo apt-get install -y zip
cd release
tar -zcvf citrea-${{ github.ref_name }}-x86_64.tar.gz citrea
zip ../citrea-${{ github.ref_name }}-x86_64.zip citrea
cd ..

if echo "$RESULT" | grep -q "${{ env.EXPECTED_BITCOIN_DA_ID }}"; then
echo "check_passed=true" >> $GITHUB_OUTPUT
echo "Check passed successfully."
else
echo "check_passed=false" >> $GITHUB_OUTPUT
echo "Check failed. Expected: BITCOIN_DA_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} | Actual: $RESULT"
exit 1
fi

- name: Release
if: steps.check-image.outputs.check_passed == 'true'
uses: softprops/action-gh-release@v2
with:
files: |
citrea-${{ github.ref_name }}-x86_64.tar.gz
citrea-${{ github.ref_name }}-x86_64.zip
name: x86_64 release ${{ github.ref_name }}
body: |
This is the x86_64 release for version ${{ github.ref_name }}.

It includes:
- citrea-${{ github.ref_name }}-x86_64.tar.gz
- citrea-${{ github.ref_name }}-x86_64.zip
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:22.04

RUN apt update && apt -y install curl gcc cpp cmake clang llvm && apt -y autoremove && apt clean && rm -rf /var/lib/apt/lists/*
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN /root/.cargo/bin/cargo install cargo-binstall
RUN /root/.cargo/bin/cargo binstall -y cargo-risczero
RUN /root/.cargo/bin/cargo risczero install --version v2024-04-22.0

WORKDIR /citrea
COPY . .

RUN /root/.cargo/bin/cargo build --release
cetin marked this conversation as resolved.
Show resolved Hide resolved
Loading