Skip to content

Commit 72c02e7

Browse files
ci: deploy main to devnet continuously, decouple from releases (#332)
1 parent a29b9ac commit 72c02e7

2 files changed

Lines changed: 25 additions & 12 deletions

File tree

.github/workflows/docker-build-release.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,16 @@ jobs:
125125
name: Open devnet deploy PR
126126
needs: build-and-push
127127
runs-on: ubuntu-latest
128-
if: startsWith(github.ref, 'refs/tags/v') || startsWith(inputs.tag, 'v')
128+
# Devnet continuously tracks main: deploy the main-<sha> image on every
129+
# direct push to main. Release builds (workflow_call with a version tag)
130+
# and manual dispatches build images only — mainnet promotion is manual.
131+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && inputs.tag == ''
129132
steps:
130-
- name: Compute version
133+
- name: Compute image tag
131134
id: version
132-
env:
133-
REF: ${{ github.ref_name }}
134-
INPUT: ${{ inputs.tag }}
135135
run: |
136-
VERSION="${INPUT:-$REF}"
137-
[[ "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]] || { echo "Invalid version: $VERSION"; exit 1; }
136+
# Must match the main-<sha> tag produced by docker/metadata-action above
137+
VERSION="main-${GITHUB_SHA::7}"
138138
echo "version=$VERSION" >> $GITHUB_OUTPUT
139139
140140
- name: Checkout infra-kubernetes
@@ -157,9 +157,11 @@ jobs:
157157
GH_TOKEN: ${{ secrets.INFRA_GH_TOKEN }}
158158
FILE_PATH: definitions/canton/validator-dev1/canton-middleware-api-values.yml
159159
REPO: ChainSafe/infra-kubernetes
160+
SOURCE_REPO: ${{ github.repository }}
161+
SOURCE_SHA: ${{ github.sha }}
160162
run: |
161-
BRANCH="chore/bump-canton-middleware-api-${VERSION}"
162-
COMMIT_MSG="chore: bump canton-middleware-api to ${VERSION} on devnet"
163+
BRANCH="cd/devnet-canton-middleware-api-${VERSION}"
164+
COMMIT_MSG="chore(devnet): deploy canton-middleware-api ${VERSION}"
163165
164166
# Get current HEAD SHA of main
165167
HEAD_SHA=$(gh api repos/${REPO}/git/ref/heads/main --jq '.object.sha')
@@ -207,10 +209,18 @@ jobs:
207209
-f contents="${FILE_CONTENTS}"
208210
209211
# Open PR and enable auto-merge
212+
PR_BODY=$(cat <<EOF
213+
Automated continuous deployment to \`validator-dev1\`.
214+
215+
Bumps \`canton-middleware-api\` image tag to \`${VERSION}\`.
216+
217+
Source: [${SOURCE_REPO}@${SOURCE_SHA:0:7}](https://github.com/${SOURCE_REPO}/commit/${SOURCE_SHA})
218+
EOF
219+
)
210220
gh pr create \
211221
--repo "${REPO}" \
212222
--title "${COMMIT_MSG}" \
213-
--body "Automated PR: bump \`canton-middleware-api\` image tag to \`${VERSION}\` on \`validator-dev1\`." \
223+
--body "${PR_BODY}" \
214224
--base main \
215225
--head "${BRANCH}" \
216226
|| { echo "PR already exists for this branch, skipping"; exit 0; }

.github/workflows/release-please.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ jobs:
2626
config-file: release-please-config.json
2727
manifest-file: .release-please-manifest.json
2828

29-
build-and-deploy:
30-
name: Build images and open devnet PR
29+
# Builds the versioned vX.Y.Z images for manual mainnet promotion.
30+
# Devnet is NOT deployed here — it tracks main via the push trigger in
31+
# docker-build-release.yml (the open-devnet-pr job is skipped when tag is set).
32+
build-release-images:
33+
name: Build versioned release images
3134
needs: release-please
3235
if: needs.release-please.outputs.release_created == 'true'
3336
uses: ./.github/workflows/docker-build-release.yml

0 commit comments

Comments
 (0)