-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
2 changed files
with
41 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |