Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
73 changes: 73 additions & 0 deletions .github/workflows/tag_latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Ethrex Latest Release

on:
release:
types:
- edited

permissions:
contents: read
packages: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
get_latest_release:
name: "Get latest release tag"
runs-on: ubuntu-latest
outputs:
latest_tag: ${{ steps.get_latest_release.outputs.latest_tag }}

steps:
- name: Get latest release tag from GH API
id: get_latest_release
run: |
tag=$(curl -s https://api.github.com/repos/${{ env.IMAGE_NAME }}/releases/latest | jq -r .tag_name)
echo "Latest release tag: $tag"
echo "latest_tag=$tag" >> $GITHUB_OUTPUT

retag_docker_images:
name: "Tag latest Docker images"
runs-on: ubuntu-latest
needs: [get_latest_release]
if: ${{ needs.get_latest_release.outputs.latest_tag == github.event.release.tag_name && github.event.changes.tag_name.from }}

# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
id-token: write

steps:
- name: Set tags
run: |
echo "PREV_TAG=$(echo ${{ github.event.changes.tag_name.from }} | tr -d v)" >> $GITHUB_ENV
echo "NEW_TAG=$(echo ${{ github.event.release.tag_name }} | tr -d v)" >> $GITHUB_ENV

- name: Login to Docker registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Download Docker images
run: |
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.PREV_TAG }}
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.PREV_TAG }}-l2

- name: Retag Docker images
run: |
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.PREV_TAG }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.NEW_TAG }}
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.PREV_TAG }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.PREV_TAG }}-l2 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:l2
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.PREV_TAG }}-l2 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.NEW_TAG }}-l2

- name: Push retagged Docker images
run: |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.NEW_TAG }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.NEW_TAG }}-l2
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:l2
32 changes: 10 additions & 22 deletions .github/workflows/tag_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Ethrex Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-*"
- "v*.*.*-*"

permissions:
contents: write
Expand Down Expand Up @@ -198,16 +197,6 @@ jobs:
run: |
echo "TAG_VERSION=$(echo ${{ github.ref_name }} | tr -d v)" >> $GITHUB_ENV

- name: Select tags
run: |
if [ "$(echo ${{ github.ref_name }}- | cut -d- -f2 | grep '^rc')" == "" ]; then
echo "L1_TAGS=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_VERSION }}" >> $GITHUB_ENV
echo "L2_TAGS=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:l2,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_VERSION }}-l2" >> $GITHUB_ENV
else
echo "L1_TAGS=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_VERSION }}" >> $GITHUB_ENV
echo "L2_TAGS=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_VERSION }}-l2" >> $GITHUB_ENV
fi

# Pushes to ghcr.io/lambdaclass/ethrex
- name: Build and push L1 Docker image
id: push_l1
Expand All @@ -217,7 +206,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
push: true
tags: ${{ env.L1_TAGS }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_VERSION }}

# Pushes to ghcr.io/lambdaclass/ethrex
- name: Build and push L2 Docker image
Expand All @@ -228,7 +217,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
push: true
tags: ${{ env.L2_TAGS }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_VERSION }}-l2
build_args: BUILD_FLAGS=--features l2,l2-sql

# Creates a release on GitHub with the binaries
Expand All @@ -252,12 +241,11 @@ jobs:

- name: Get previous tag
run: |
name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)
echo "PREVIOUS_TAG: $name"
echo "PREVIOUS_TAG=$name" >> $GITHUB_ENV

- name: Check release type
run: echo "TAG_SUFFIX=$(echo ${{ github.ref_name }}- | cut -d- -f2)" >> $GITHUB_ENV
last_tag=$(git --no-pager tag --sort=creatordate | grep -v -E '^v[0-9]+\.[0-9]+\.[0-9]+-' | grep -v '${{ github.ref_name }}' | tail -1)
echo "Last tag: $last_tag"
common_parent=$(git merge-base ${{ github.ref_name }} $last_tag)
echo "PREVIOUS_TAG: $common_parent"
echo "PREVIOUS_TAG=$common_parent" >> $GITHUB_ENV

- name: Update CHANGELOG
id: changelog
Expand All @@ -274,8 +262,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ./bin/**/*
draft: ${{ startsWith(env.TAG_SUFFIX, 'rc') }}
prerelease: ${{ startsWith(env.TAG_SUFFIX, 'rc') }}
draft: false
prerelease: true
tag_name: ${{ github.ref_name }}
name: "ethrex: ${{ github.ref_name }}"
body: >
Expand Down
36 changes: 20 additions & 16 deletions docs/developers/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,17 @@ There are currently three `Cargo.lock` files that will be affected. Make sure yo

## 3rd - Create & Push Tag

Create a tag with a format `vX.Y.Z[-custom]` where `X.Y.Z` is the semantic version and `-custom` is an optional subversion. Example of valid tags:
Create a tag with a format `vX.Y.Z-rc.W` where `X.Y.Z` is the semantic version and `W` is a release candidate version. Other names for subversions are also accepted. Example of valid tags:

- `v0.0.1`
- `v0.1.3-rc.1`
- `v0.0.2-alpha`

```bash
git tag <release_version>
git push --tags
git push origin <release_version>
```

After pushing the tag, a CI job will compile the binaries for different architectures and create a release with the version specified in the tag name. Along with the binaries, a tar file is uploaded with the contracts and the verification keys. The following binaries are built:
After pushing the tag, a CI job will compile the binaries for different architectures and create a pre-release with the version specified in the tag name. Along with the binaries, a tar file is uploaded with the contracts and the verification keys. The following binaries are built:

| name | L2 stack | Provers | CUDA support |
| --- | --- | --- | --- |
Expand All @@ -53,21 +52,27 @@ After pushing the tag, a CI job will compile the binaries for different architec
| ethrex-l2-macos-aarch64 | ✅ | Exec | ❌ |

Also, two docker images are built and pushed to the Github Container registry:
- `ghcr.io/lambdaclass/ethrex:latest`
- `ghcr.io/lambdaclass/ethrex:X.Y.Z[-custom]`
- `ghcr.io/lambdaclass/ethrex:l2`
- `ghcr.io/lambdaclass/ethrex:X.Y.Z[-custom]-l2`
- `ghcr.io/lambdaclass/ethrex:X.Y.Z-rc.W`
- `ghcr.io/lambdaclass/ethrex:X.Y.Z-rc.W-l2`

A changelog will be generated based on commit names (using conventional commits) from the last tag.
A changelog will be generated based on commit names (using conventional commits) from the last stable tag.

> [!NOTE]
> If the tag has format `vX.Y.Z-rc*`, the release will be a pre-release and in draft mode. Also, `latest` and `l2` docker tags will not be updated.
## 4th - Test & Publish Release

## 4th - Update Homebrew
When you are sure all the binaries and docker images work as expected, you can proceed to publish the release. To do so, edit the last pre-release with the following changes:
- Change the name to `ethrex: vX.Y.Z`
- Change the tag to a new one `vX.Y.Z`. **IMPORTANT**: Make sure to select the `release/vX.Y.Z` branch when changing the tag.
- Set the release as the latest release (you will need to uncheck the pre-release first).

Once done, the CI will publish new tags for the already compiled docker images:
- `ghcr.io/lambdaclass/ethrex:X.Y.Z`, `ghcr.io/lambdaclass/ethrex:latest`
- `ghcr.io/lambdaclass/ethrex:X.Y.Z-l2`, `ghcr.io/lambdaclass/ethrex:l2`

## 5th - Update Homebrew

Disclaimer: We should automate this

1. Commit a change in https://github.com/lambdaclass/homebrew-tap/ bumping the ethrex version (like this one https://github.com/lambdaclass/homebrew-tap/commit/d78a2772ad9c5412e7f84c6210bd85c970fcd0e6).
1. Commit a change in https://github.com/lambdaclass/homebrew-tap/ bumping the ethrex version (like [this one](https://github.com/lambdaclass/homebrew-tap/commit/d78a2772ad9c5412e7f84c6210bd85c970fcd0e6)).
- The first SHA is the hash of the `.tar.gz` from the release. You can get it by downloading the `Source code (tar.gz)` from the ethrex release and running

```bash
Expand Down Expand Up @@ -105,10 +110,9 @@ Disclaimer: We should automate this

- Use this as the second hash (the one in the `bottle` section)
2. Push the commit
3. Create a new release with tag `v3.0.0`
IMPORTANT: attach the `ethrex-3.0.0.arm64_sonoma.bottle.tar.gz` to the release
3. Create a new release with tag `v3.0.0`. **IMPORTANT**: attach the `ethrex-3.0.0.arm64_sonoma.bottle.tar.gz` to the release

## 5th - Merge the release branch via PR
## 6th - Merge the release branch via PR

Once the release is verified, **merge the branch via PR**.

Expand Down
Loading