@@ -2,10 +2,8 @@ name: Production Release
22
33on :
44 push :
5- branches :
6- - main
7- tags-ignore :
8- - ' *'
5+ tags :
6+ - ' v*'
97
108permissions :
119 contents : write
@@ -22,32 +20,16 @@ jobs:
2220 with :
2321 fetch-depth : 0
2422
25- - name : Get version from Cargo.toml
23+ - name : Get version from tag
2624 id : get_version
2725 run : |
28- VERSION=$(grep '^version =' Cargo.toml | head -n 1 | cut -d '"' -f 2)
26+ # Get the tag that triggered this workflow
27+ TAG_NAME="${{ github.ref_name }}"
28+ VERSION="${TAG_NAME#v}" # Remove 'v' prefix
2929 echo "version=${VERSION}" >> $GITHUB_OUTPUT
30- echo "tag_name=v${VERSION}" >> $GITHUB_OUTPUT
31-
32- - name : Check if tag exists
33- id : check_tag
34- run : |
35- if git rev-parse "v${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
36- echo "exists=true" >> $GITHUB_OUTPUT
37- else
38- echo "exists=false" >> $GITHUB_OUTPUT
39- fi
40-
41- - name : Create and push tag
42- if : steps.check_tag.outputs.exists == 'false'
43- run : |
44- git config --local user.email "github-actions[bot]@users.noreply.github.com"
45- git config --local user.name "github-actions[bot]"
46- git tag -a "v${{ steps.get_version.outputs.version }}" -m "Release v${{ steps.get_version.outputs.version }}"
47- git push origin "v${{ steps.get_version.outputs.version }}"
30+ echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
4831
4932 - name : Install Rust toolchain
50- if : steps.check_tag.outputs.exists == 'false'
5133 uses : actions-rs/toolchain@v1
5234 with :
5335 toolchain : stable
@@ -56,13 +38,11 @@ jobs:
5638 - name : Build all workspace members
5739 env :
5840 WORKER_RPC_URL : https://sepolia.base.org
59- if : steps.check_tag.outputs.exists == 'false'
6041 run : |
6142 export CARGO_BUILD_JOBS=$(nproc)
6243 cargo build --release --workspace --features testnet
6344
6445 - name : Prepare binaries
65- if : steps.check_tag.outputs.exists == 'false'
6646 run : |
6747 mkdir -p release-artifacts
6848 for binary in worker validator orchestrator discovery; do
7252 done
7353
7454 - name : Generate checksums
75- if : steps.check_tag.outputs.exists == 'false'
7655 run : |
7756 cd release-artifacts
7857 for file in *-linux-x86_64; do
@@ -83,21 +62,20 @@ jobs:
8362 cd ..
8463
8564 - name : Create Release
86- if : steps.check_tag.outputs.exists == 'false'
8765 uses : softprops/action-gh-release@v1
8866 with :
89- tag_name : v ${{ steps.get_version.outputs.version }}
90- name : Release v ${{ steps.get_version.outputs.version }}
67+ tag_name : ${{ steps.get_version.outputs.tag_name }}
68+ name : Release ${{ steps.get_version.outputs.tag_name }}
9169 body : |
92- 🚀 Production Release v ${{ steps.get_version.outputs.version }}
70+ 🚀 Production Release ${{ steps.get_version.outputs.tag_name }}
9371
9472 ⚠️ Currently using testnet configuration
9573
9674 Platform:
9775 - Linux x86_64
9876
9977 Components:
100- - worker
78+ - Worker
10179 - Validator
10280 - Orchestrator
10381 - Discovery service
@@ -121,74 +99,65 @@ jobs:
12199 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
122100
123101 - name : Authenticate to Google Cloud
124- if : steps.check_tag.outputs.exists == 'false'
125102 uses : google-github-actions/auth@v1
126103 with :
127104 credentials_json : ${{ secrets.GCP_SA_KEY }}
128105
129106 - name : Set up Google Cloud SDK
130- if : steps.check_tag.outputs.exists == 'false'
131107 uses : google-github-actions/setup-gcloud@v1
132108
133109 - name : Configure Docker for Artifact Registry
134- if : steps.check_tag.outputs.exists == 'false'
135110 run : |
136111 gcloud auth configure-docker us-east1-docker.pkg.dev
137112
138113 - name : Set up Docker Buildx
139- if : steps.check_tag.outputs.exists == 'false'
140114 uses : docker/setup-buildx-action@v2
141115
142116 - name : Login to GitHub Container Registry
143- if : steps.check_tag.outputs.exists == 'false'
144117 uses : docker/login-action@v2
145118 with :
146119 registry : ghcr.io
147120 username : ${{ github.actor }}
148121 password : ${{ secrets.GITHUB_TOKEN }}
149122
150123 - name : Generate Docker metadata
151- if : steps.check_tag.outputs.exists == 'false'
152124 id : meta
153125 run : |
154126 REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
155127 echo "repo_lower=${REPO_LOWER}" >> $GITHUB_OUTPUT
156128
157129 - name : Build and push Discovery image
158- if : steps.check_tag.outputs.exists == 'false'
159130 uses : docker/build-push-action@v4
160131 with :
161132 context : .
162133 file : ./crates/discovery/Dockerfile
163134 push : true
164135 tags : |
165136 ghcr.io/${{ steps.meta.outputs.repo_lower }}/discovery:latest
166- ghcr.io/${{ steps.meta.outputs.repo_lower }}/discovery:v ${{ steps.get_version.outputs.version }}
137+ ghcr.io/${{ steps.meta.outputs.repo_lower }}/discovery:${{ steps.get_version.outputs.tag_name }}
167138 us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/discovery:latest
168- us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/discovery:v ${{ steps.get_version.outputs.version }}
139+ us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/discovery:${{ steps.get_version.outputs.tag_name }}
169140
170141 - name : Build and push Validator image
171- if : steps.check_tag.outputs.exists == 'false'
172142 uses : docker/build-push-action@v4
173143 with :
174144 context : .
175145 file : ./crates/validator/Dockerfile
176146 push : true
177147 tags : |
178148 ghcr.io/${{ steps.meta.outputs.repo_lower }}/validator:latest
179- ghcr.io/${{ steps.meta.outputs.repo_lower }}/validator:v ${{ steps.get_version.outputs.version }}
149+ ghcr.io/${{ steps.meta.outputs.repo_lower }}/validator:${{ steps.get_version.outputs.tag_name }}
180150 us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/validator:latest
181- us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/validator:v ${{ steps.get_version.outputs.version }}
151+ us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/validator:${{ steps.get_version.outputs.tag_name }}
182152
183153 - name : Build and push Orchestrator image
184- if : steps.check_tag.outputs.exists == 'false'
185154 uses : docker/build-push-action@v4
186155 with :
187156 context : .
188157 file : ./crates/orchestrator/Dockerfile
189158 push : true
190159 tags : |
191160 ghcr.io/${{ steps.meta.outputs.repo_lower }}/orchestrator:latest
192- ghcr.io/${{ steps.meta.outputs.repo_lower }}/orchestrator:v ${{ steps.get_version.outputs.version }}
161+ ghcr.io/${{ steps.meta.outputs.repo_lower }}/orchestrator:${{ steps.get_version.outputs.tag_name }}
193162 us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/orchestrator:latest
194- us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/orchestrator:v ${{ steps.get_version.outputs.version }}
163+ us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/prime-protocol/orchestrator:${{ steps.get_version.outputs.tag_name }}
0 commit comments