Skip to content

Commit 9e8da00

Browse files
release.yml
1 parent fb9e041 commit 9e8da00

File tree

15 files changed

+629
-315
lines changed

15 files changed

+629
-315
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
33
- package-ecosystem: "cargo"
4-
directories: ["/enclaves/**"]
4+
directories: ["/enclaves/**/*"]
55
schedule:
66
interval: "weekly"
77
open-pull-requests-limit: 3

.github/workflows/release.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
enclave:
6+
type: string
7+
required: true
8+
description: 'Enclave to be released'
9+
options:
10+
- ethereum
11+
- optimism
12+
- parlia
13+
network:
14+
type: string
15+
required: true
16+
default: mainnet
17+
options:
18+
- testnet
19+
- mainnet
20+
description: 'The network on which the enclave runs.'
21+
tag:
22+
type: string
23+
required: true
24+
description: 'Tag Name(e.g. v1.2.3)'
25+
draft:
26+
type: boolean
27+
required: true
28+
default: false
29+
description: 'create a release as draft'
30+
prerelease:
31+
type: boolean
32+
required: true
33+
default: false
34+
description: 'create a release as prerelease'
35+
36+
jobs:
37+
release:
38+
runs-on: ubuntu-24.04
39+
permissions:
40+
contents: write # Push Tag and Create Release
41+
packages: write # Push Docker Image to ghcr.io
42+
steps:
43+
- uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0
46+
- name: Check if tag exists
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
OWNER: ${{ github.repository_owner }}
50+
REPO: ${{ github.event.repository.name }}
51+
TAG: ${{ github.event.inputs.enclave }}-${{ github.event.inputs.network }}-${{ github.event.inputs.tag }}
52+
run: |
53+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
54+
-H "Authorization: token ${GITHUB_TOKEN}" \
55+
"https://api.github.com/repos/${OWNER}/${REPO}/git/refs/tags/${TAG}")
56+
if [ "$STATUS" = "200" ]; then
57+
echo "🚫 Tag '${TAG}' already exists."
58+
exit 1
59+
fi
60+
- name: Configure Git user
61+
run: |
62+
git config user.name "github-actions[bot]"
63+
git config user.email "github-actions[bot]@users.noreply.github.com"
64+
- uses: docker/setup-buildx-action@v3
65+
- uses: docker/login-action@v3
66+
with:
67+
registry: ghcr.io
68+
username: ${{ github.actor }}
69+
password: ${{ github.token }}
70+
logout: true
71+
- id: meta
72+
uses: docker/metadata-action@v5
73+
with:
74+
images: ghcr.io/${{ github.repository }}/${{ github.event.inputs.enclave }}/${{ github.event.inputs.network }}
75+
tags: |
76+
type=sha,prefix=,format=long
77+
${{ github.event.inputs.tag }}
78+
- name: Build and Release
79+
uses: docker/build-push-action@v5
80+
id: docker_build_and_push
81+
with:
82+
context: .
83+
push: true
84+
build-args: |
85+
LCP_ELC_TYPE=${{ github.event.inputs.enclave }}
86+
DEPLOYMENT_NETWORK=${{ github.event.inputs.network }}
87+
tags: ${{ steps.meta.outputs.tags }}
88+
labels: ${{ steps.meta.outputs.labels }}
89+
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/${{ github.event.inputs.enclave }}/${{ github.event.inputs.network }}:buildCache
90+
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/${{ github.event.inputs.enclave }}/${{ github.event.inputs.network }}:buildCache,mode=max
91+
- name: Create Release
92+
uses: softprops/action-gh-release@v2
93+
with:
94+
name: ${{ github.event.inputs.enclave }}/${{ github.event.inputs.network }}/${{ github.event.inputs.tag }}
95+
tag_name: ${{ github.event.inputs.enclave }}-${{ github.event.inputs.network }}-${{ github.event.inputs.tag }}
96+
draft: ${{ github.event.inputs.draft }}
97+
prerelease: ${{ github.event.inputs.prerelease }}
98+
generate_release_notes: true
99+
append_body: true
100+
body: |
101+
## Docker Image
102+
1. Image Digest: ${{ steps.docker_build_and_push.outputs.imageid }}
103+
2. [Link to Docker Image](https://github.com/${{ github.repository }}/pkgs/container/${{ github.event.repository.name }}%2F${{ github.event.inputs.enclave }}%2F${{ github.event.inputs.network }}?sha256=${{ steps.docker_build_and_push.outputs.digest }})

.github/workflows/test.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build enclave images
1+
name: Test
22
on:
33
pull_request:
44

@@ -51,8 +51,8 @@ jobs:
5151
- id: meta
5252
uses: docker/metadata-action@v5
5353
with:
54-
images: ghcr.io/${{ github.repository }}
55-
tags: ${{ matrix.enclave }}-${{ matrix.network }}-${{ github.event.pull_request.head.sha }}
54+
images: ghcr.io/${{ github.repository }}/${{ matrix.enclave }}/${{ matrix.network }}
55+
tags: ${{ github.event.pull_request.head.sha }}
5656
- uses: docker/build-push-action@v5
5757
with:
5858
context: .
@@ -62,5 +62,13 @@ jobs:
6262
DEPLOYMENT_NETWORK=${{ matrix.network }}
6363
tags: ${{ steps.meta.outputs.tags }}
6464
labels: ${{ steps.meta.outputs.labels }}
65-
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ matrix.enclave }}-${{ matrix.network }}-buildCache
66-
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:${{ matrix.enclave }}-${{ matrix.network }}-buildCache,mode=max
65+
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/${{ matrix.enclave }}/${{ matrix.network }}:buildCache
66+
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/${{ matrix.enclave }}/${{ matrix.network }}:buildCache,mode=max
67+
- name: Output MRENCLAVE
68+
run: |
69+
mkdir -p tests/mrenclave
70+
docker run -it --rm -v $(pwd)/tests/mrenclave:/tests/mrenclave ghcr.io/${{ github.repository }}/${{ github.event.inputs.enclave }}/${{ github.event.inputs.network }}:${{ github.sha }} \
71+
bash -c "/app/scripts/mrenclave.sh /out /tests/mrenclave"
72+
- name: Show MRENCLAVE
73+
run: |
74+
cat tests/mrenclave/mrenclave.txt

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:noble-20250415.1
1+
FROM ubuntu:noble-20250529
22

33
ARG INTEL_SGX_SDK_VERSION=2.25.100.3
44
LABEL com.intel.sgx.sdk.version=$INTEL_SGX_SDK_VERSION
@@ -17,7 +17,9 @@ ENV DEBIAN_FRONTEND=noninteractive
1717
WORKDIR /app
1818

1919
# ref: https://github.com/intel/linux-sgx/blob/sgx_2.25/README.md#install-the-intelr-sgx-sdk
20-
RUN apt update && apt install -y build-essential curl file python-is-python3 && \
20+
RUN apt update && apt install -y \
21+
build-essential=12.10ubuntu1 \
22+
curl file python-is-python3 && \
2123
rm -rf /var/lib/apt/lists/*
2224

2325
ENV INTEL_SGX_SDK_VERSION=$INTEL_SGX_SDK_VERSION

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
# toki-bridge-lcp-encalves
1+
# toki-bridge-lcp-enclaves
2+

0 commit comments

Comments
 (0)