Skip to content

Commit

Permalink
ci: Add release workflow (#11180)
Browse files Browse the repository at this point in the history
* ci: Add prerelease workflow

Signed-off-by: Oliver Koenig <[email protected]>

* test

Signed-off-by: Oliver Koenig <[email protected]>

* test

Signed-off-by: Oliver Koenig <[email protected]>

* test

Signed-off-by: Oliver Koenig <[email protected]>

* fix

Signed-off-by: Oliver Koenig <[email protected]>

* use pat

Signed-off-by: Oliver Koenig <[email protected]>

* finalize

Signed-off-by: Oliver Koenig <[email protected]>

* fix

Signed-off-by: Oliver Koenig <[email protected]>

* tmp

Signed-off-by: Oliver Koenig <[email protected]>

* fix

Signed-off-by: Oliver Koenig <[email protected]>

* test

Signed-off-by: Oliver Koenig <[email protected]>

* test

Signed-off-by: Oliver Koenig <[email protected]>

* fix

Signed-off-by: Oliver Koenig <[email protected]>

* fix

Signed-off-by: Oliver Koenig <[email protected]>

* fix

Signed-off-by: Oliver Koenig <[email protected]>

* fix

Signed-off-by: Oliver Koenig <[email protected]>

* test

Signed-off-by: Oliver Koenig <[email protected]>

* test

Signed-off-by: Oliver Koenig <[email protected]>

* test

Signed-off-by: Oliver Koenig <[email protected]>

* test

Signed-off-by: Oliver Koenig <[email protected]>

* fix

Signed-off-by: Oliver Koenig <[email protected]>

* finalize

Signed-off-by: Oliver Koenig <[email protected]>

---------

Signed-off-by: Oliver Koenig <[email protected]>
  • Loading branch information
ko3n1g authored Nov 8, 2024
1 parent 31c4e8a commit 922e840
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 105 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release-freeze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ on:
options:
- major
- minor
- pre_release
mcore_version:
description: 'Version of MCore to use (must be a valid git ref)'
required: true
type: string

jobs:
code-freeze:
uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/_code_freeze.yml@v0.1.0
uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/_code_freeze.yml@v0.8.0
with:
name_of_library: NeMo-Toolkit
type_of_release: ${{ inputs.type_of_release }}
library_name: NeMo-Toolkit
python_package: nemo
type_of_release: ${{ inputs.type_of_release }}
secrets:
SLACK_RELEASE_ENDPOINT: ${{ secrets.SLACK_RELEASE_ENDPOINT }}

SLACK_WEBHOOK_ADMIN: ${{ secrets.SLACK_WEBHOOK_ADMIN }}

freeze-tags:
runs-on: ubuntu-latest
needs: [code-freeze]
Expand Down
136 changes: 36 additions & 100 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,105 +1,41 @@
name: "NeMo Code release"

on:
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "Release Neural Modules"

on:
workflow_dispatch:
inputs:
branch:
description: Branch to release
release-ref:
description: Ref (SHA or branch name) to release
required: true
type: string
jobs:
main:
if: contains(fromJSON('["ko3n1g"]'), github.actor)
runs-on: ubuntu-latest
environment:
name: main
steps:

- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.run_id }}
ref: ${{ inputs.branch }}

- name: Create release
id: version-number
run: |
cd ${{ github.run_id }}
VERSION=$(python -c "import nemo; print(nemo.__version__)")
NAME="NVIDIA Neural Modules ${VERSION}"
CHANGELOG=$(awk '/^## '"$NAME"'/{flag=1; next} /^## /{flag=0} flag' CHANGELOG.md)
CHANGELOG=$(echo "$CHANGELOG" | sed '/./,$!d' | sed ':a;N;$!ba;s/\n$//')
PAYLOAD=$(jq \
-n \
-c \
--arg TAG_NAME "v${VERSION}" \
--arg CI_COMMIT_BRANCH "${{ inputs.branch }}" \
--arg NAME "$NAME" \
--arg BODY "$CHANGELOG" \
'{
"tag_name": $TAG_NAME,
"target_commitish": $CI_COMMIT_BRANCH,
"name": $NAME,
"body": $BODY,
"draft": false,
"prerelease": false,
"generate_release_notes": false
}'
)
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/NVIDIA/NeMo/releases \
-d "$PAYLOAD"
- name: Build, test, and release wheel
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
cd ${{ github.run_id }}
EXPECTED_VERSION=$(python -c 'import nemo; print(nemo.__version__)')
python3 -m pip install --upgrade build
python3 -m build
pip install dist/*.whl

cd ../
INSTALLED_VERSION=$(python -c 'import nemo; print(nemo.__version__)')
if [[ "$INSTALLED_VERSION" != "$EXPECTED_VERSION" ]]; then
echo 'Wheel has an outdated version, mission abort immediately!'
exit 1
fi
echo Proceed with uploading wheel...
cd ${{ github.run_id }}
python3 -m pip install --upgrade twine
python3 -m twine upload --repository pypi dist/*
- name: notify
run: |
VERSION=${{ steps.version-number.outputs.VERSION }}
URL="https://github.com/NVIDIA/NeMo/releases/tag/v$VERSION"
MESSAGE='{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Releasebot 🤖: NeMo-Toolkit released <'$URL'|`'$VERSION'`> 🚀"
}
}
]
}'
curl -X POST -H "Content-type: application/json" --data "$MESSAGE" ${{ secrets.SLACK_RELEASE_ENDPOINT }}
jobs:
release:
uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/[email protected]
with:
release-ref: ${{ inputs.release-ref }}
image-name: nemo_container
dockerfile: Dockerfile.ci
image-label: nemo-core
build-args: |
IMAGE_LABEL=nemo-core
prune-filter-timerange: 24h
python-package: nemo
container-workdir: /workspace
library-name: Neural Modules
secrets:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
SLACK_RELEASE_ENDPOINT: ${{ secrets.SLACK_RELEASE_ENDPOINT }}

0 comments on commit 922e840

Please sign in to comment.