Skip to content

Commit ae5f3e2

Browse files
authored
Perform release 5 (#1559)
1 parent 448599e commit ae5f3e2

File tree

1 file changed

+77
-15
lines changed

1 file changed

+77
-15
lines changed

.github/workflows/perform-release.yml

Lines changed: 77 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ name: Perform Release
33
on:
44
workflow_dispatch:
55
inputs:
6+
source-branch:
7+
description: '*** SOURCE BRANCH *** — Branch to build artifacts from (leave empty to use the branch selected above)'
8+
required: false
9+
type: string
10+
default: ''
11+
version:
12+
description: 'Override release version (leave empty to derive from source branch name)'
13+
required: false
14+
type: string
15+
default: ''
616
dry-run:
717
description: 'Build and validate artifacts without publishing'
818
required: false
@@ -18,26 +28,42 @@ on:
1828
- dev
1929

2030
permissions:
21-
contents: read
31+
contents: write
2232
packages: write
2333

2434
jobs:
2535
determine-version:
2636
name: Determine Release Version
2737
runs-on: ubuntu-latest
2838
outputs:
29-
version: ${{ steps.version.outputs.version }}
39+
version: ${{ steps.resolve.outputs.version }}
40+
source-ref: ${{ steps.resolve.outputs.source_ref }}
3041
steps:
31-
- name: Extract version from branch name
32-
id: version
42+
- name: Resolve source branch and version
43+
id: resolve
3344
run: |
34-
VERSION="${{ github.ref_name }}"
45+
if [ -n "${{ inputs.source-branch }}" ]; then
46+
SOURCE_REF="${{ inputs.source-branch }}"
47+
else
48+
SOURCE_REF="${{ github.ref_name }}"
49+
fi
50+
echo "source_ref=$SOURCE_REF" >> $GITHUB_OUTPUT
51+
52+
if [ -n "${{ inputs.version }}" ]; then
53+
VERSION="${{ inputs.version }}"
54+
echo "Using explicit version: $VERSION"
55+
else
56+
VERSION="$SOURCE_REF"
57+
echo "Derived version from source branch: $VERSION"
58+
fi
3559
echo "version=$VERSION" >> $GITHUB_OUTPUT
60+
3661
echo "### Release Configuration" >> $GITHUB_STEP_SUMMARY
3762
echo "| Setting | Value |" >> $GITHUB_STEP_SUMMARY
3863
echo "|---------|-------|" >> $GITHUB_STEP_SUMMARY
3964
echo "| Version | \`$VERSION\` |" >> $GITHUB_STEP_SUMMARY
40-
echo "| Branch | \`${{ github.ref_name }}\` |" >> $GITHUB_STEP_SUMMARY
65+
echo "| Source Branch | \`$SOURCE_REF\` |" >> $GITHUB_STEP_SUMMARY
66+
echo "| Workflow Branch | \`${{ github.ref_name }}\` |" >> $GITHUB_STEP_SUMMARY
4167
echo "| Dry Run | \`${{ inputs.dry-run }}\` |" >> $GITHUB_STEP_SUMMARY
4268
echo "| Release Type | \`${{ inputs.release-type }}\` |" >> $GITHUB_STEP_SUMMARY
4369
@@ -53,7 +79,7 @@ jobs:
5379
with:
5480
version: ${{ needs.determine-version.outputs.version }}
5581
release-type: ${{ inputs.release-type }}
56-
source-ref: ${{ github.ref_name }}
82+
source-ref: ${{ needs.determine-version.outputs.source-ref }}
5783
runner: linux-large-disk
5884

5985
nvingest-docker-build:
@@ -66,7 +92,7 @@ jobs:
6692
- name: Checkout code
6793
uses: actions/checkout@v4
6894
with:
69-
ref: ${{ github.ref_name }}
95+
ref: ${{ needs.determine-version.outputs.source-ref }}
7096

7197
- name: Setup Docker Buildx
7298
uses: ./.github/actions/setup-docker-buildx
@@ -102,7 +128,7 @@ jobs:
102128
- name: Checkout repository
103129
uses: actions/checkout@v4
104130
with:
105-
ref: ${{ github.ref_name }}
131+
ref: ${{ needs.determine-version.outputs.source-ref }}
106132
fetch-depth: 0
107133

108134
- name: Setup Docker Buildx
@@ -134,7 +160,7 @@ jobs:
134160
- name: Checkout code
135161
uses: actions/checkout@v4
136162
with:
137-
ref: ${{ github.ref_name }}
163+
ref: ${{ needs.determine-version.outputs.source-ref }}
138164

139165
- name: Setup Helm
140166
uses: azure/setup-helm@v4
@@ -212,7 +238,7 @@ jobs:
212238
- name: Checkout code
213239
uses: actions/checkout@v4
214240
with:
215-
ref: ${{ github.ref_name }}
241+
ref: ${{ needs.determine-version.outputs.source-ref }}
216242

217243
- name: Setup Docker Buildx
218244
uses: ./.github/actions/setup-docker-buildx
@@ -253,7 +279,7 @@ jobs:
253279
- name: Checkout repository
254280
uses: actions/checkout@v4
255281
with:
256-
ref: ${{ github.ref_name }}
282+
ref: ${{ needs.determine-version.outputs.source-ref }}
257283
fetch-depth: 0
258284

259285
- name: Setup Docker Buildx
@@ -297,7 +323,7 @@ jobs:
297323
- name: Checkout code
298324
uses: actions/checkout@v4
299325
with:
300-
ref: ${{ github.ref_name }}
326+
ref: ${{ needs.determine-version.outputs.source-ref }}
301327

302328
- name: Setup Helm
303329
uses: azure/setup-helm@v4
@@ -358,6 +384,31 @@ jobs:
358384
--name nv-ingest \
359385
--version "${{ needs.determine-version.outputs.version }}"
360386
387+
# ── Tag Release ───────────────────────────────────────────────────────
388+
tag-release:
389+
name: Tag Release
390+
if: ${{ !inputs.dry-run }}
391+
needs:
392+
- determine-version
393+
- pypi-publish
394+
- nvingest-docker-publish
395+
- retriever-docker-publish
396+
- helm-publish
397+
runs-on: ubuntu-latest
398+
steps:
399+
- name: Checkout code
400+
uses: actions/checkout@v4
401+
with:
402+
ref: ${{ needs.determine-version.outputs.source-ref }}
403+
404+
- name: Create and push tag
405+
run: |
406+
VERSION="${{ needs.determine-version.outputs.version }}"
407+
git tag "$VERSION"
408+
git push origin "$VERSION"
409+
echo "### Git Tag" >> $GITHUB_STEP_SUMMARY
410+
echo "Created and pushed tag: \`$VERSION\`" >> $GITHUB_STEP_SUMMARY
411+
361412
# ── Announcement ─────────────────────────────────────────────────────
362413
announce:
363414
name: Release Announcement
@@ -372,14 +423,15 @@ jobs:
372423
- retriever-docker-publish
373424
- helm-build
374425
- helm-publish
426+
- tag-release
375427
runs-on: ubuntu-latest
376428
steps:
377429
- name: Generate Slack announcement
378430
env:
379431
VERSION: ${{ needs.determine-version.outputs.version }}
380432
DRY_RUN: ${{ inputs.dry-run }}
381433
RELEASE_TYPE: ${{ inputs.release-type }}
382-
BASE_BRANCH: ${{ github.ref_name }}
434+
SOURCE_BRANCH: ${{ needs.determine-version.outputs.source-ref }}
383435
PYPI_BUILD_RESULT: ${{ needs.pypi-build.result }}
384436
PYPI_PUBLISH_RESULT: ${{ needs.pypi-publish.result }}
385437
NVINGEST_BUILD_RESULT: ${{ needs.nvingest-docker-build.result }}
@@ -388,6 +440,7 @@ jobs:
388440
RETRIEVER_PUBLISH_RESULT: ${{ needs.retriever-docker-publish.result }}
389441
HELM_BUILD_RESULT: ${{ needs.helm-build.result }}
390442
HELM_PUBLISH_RESULT: ${{ needs.helm-publish.result }}
443+
TAG_RESULT: ${{ needs.tag-release.result }}
391444
NVINGEST_IMAGE: ${{ needs.nvingest-docker-build.outputs.image }}
392445
RETRIEVER_IMAGE: ${{ needs.retriever-docker-build.outputs.image }}
393446
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
@@ -421,7 +474,7 @@ jobs:
421474
MSG="${HEADER}"
422475
MSG+="\n"
423476
MSG+="\n*Version:* \`${VERSION}\`"
424-
MSG+="\n*Branch:* \`${BASE_BRANCH}\`"
477+
MSG+="\n*Source Branch:* \`${SOURCE_BRANCH}\`"
425478
MSG+="\n*Release Type:* \`${RELEASE_TYPE}\`"
426479
MSG+="\n"
427480
MSG+="\n*Artifacts:*"
@@ -473,6 +526,15 @@ jobs:
473526
MSG+="\n$(status_emoji "$HELM_PUBLISH_RESULT") *Helm Chart* — Publish blocked (other build failed)"
474527
fi
475528
529+
# — Git Tag —
530+
if [ "$DRY_RUN" = "true" ]; then
531+
MSG+="\n:fast_forward: *Git Tag* — Skipped (dry run)"
532+
elif [ "$TAG_RESULT" = "success" ]; then
533+
MSG+="\n:white_check_mark: *Git Tag* — \`${VERSION}\`"
534+
else
535+
MSG+="\n$(status_emoji "$TAG_RESULT") *Git Tag* — ${TAG_RESULT}"
536+
fi
537+
476538
MSG+="\n"
477539
MSG+="\n<${RUN_URL}|:github: View Workflow Run>"
478540

0 commit comments

Comments
 (0)