Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
PR revisions
Browse files Browse the repository at this point in the history
- refactor code from nm-cp-assets that gets wheel and tar.gz files into a new action that can be used for that and our nm-upload-assets-to-gcp.yml workflow
- correct syntax in the if statement
- use nm-actions @v1.0.0
  • Loading branch information
derekk-nm committed Jul 9, 2024
1 parent e60838b commit ef34d58
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 20 deletions.
19 changes: 9 additions & 10 deletions .github/actions/nm-cp-assets/action.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: cp assets
description: "cp whl and tarfile to Google storage 'neuralmagic-public-pypi/dist'"
inputs:
whl:
description: "the wheel asset file path"
required: true
targz:
description: "the tar.gz asset file path"
required: true
runs:
using: composite
steps:
- id: cp_assets
run: |
WHL=$(find assets -type f -name "*nm_vllm*.whl")
WHL_FILE=$(basename ${WHL})
echo "whl: ${WHL}"
echo "whl_file: ${WHL_FILE}"
TAR=$(find assets -path "*nm-vllm*.tar.gz" -type f -name "nm-vllm*.tar.gz")
TAR_FILE=$(basename ${TAR})
echo "tar: ${TAR}"
echo "tar_file: ${TAR_FILE}"
gcloud storage cp ${WHL} gs://neuralmagic-public-pypi/dist/${WHL_FILE}
gcloud storage cp ${TAR} gs://neuralmagic-public-pypi/dist/${TAR_FILE}
gcloud storage cp ${WHL} gs://neuralmagic-public-pypi/dist/${{ inputs.whl }}
gcloud storage cp ${TAR} gs://neuralmagic-public-pypi/dist/${{ inputs.targz }}
shell: bash
25 changes: 25 additions & 0 deletions .github/actions/nm_whl_tar_gz_names/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: get wheel and tar.gz names
description: "retrieve the whl and tarfile names from existing assets"
outputs:
whl:
description: "the wheel asset file path"
value: ${{ steps.whl_targz_names.outputs.whl }}
targz:
description: "the tar.gz asset file path"
value: ${{ steps.whl_targz_names.outputs.targz }}
runs:
using: composite
steps:
- id: whl_targz_names
run: |
WHL=$(find assets -type f -name "*nm_vllm*.whl")
WHL_FILE=$(basename ${WHL})
echo "whl: ${WHL}"
echo "whl_file: ${WHL_FILE}"
TAR=$(find assets -path "*nm-vllm*.tar.gz" -type f -name "nm-vllm*.tar.gz")
TAR_FILE=$(basename ${TAR})
echo "tar: ${TAR}"
echo "tar_file: ${TAR_FILE}"
echo "whl=${WHL_FILE}" >> $GITHUB_OUTPUT
echo "targz=${TAR_FILE}" >> $GITHUB_OUTPUT
shell: bash
1 change: 0 additions & 1 deletion .github/workflows/nm-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ jobs:
timeout: ${{ inputs.build_timeout }}
gitref: ${{ github.ref }}
wf_category: ${{ inputs.wf_category }}
whl: ${{ needs.BUILD.outputs.whl }}
secrets: inherit

# update docker
Expand Down
31 changes: 22 additions & 9 deletions .github/workflows/nm-upload-assets-to-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ on:
description: "workflow category: REMOTE, NIGHTLY, RELEASE"
type: string
default: "REMOTE"
whl:
description: "wheel file path"
type: string
required: true

workflow_dispatch:
inputs:
Expand Down Expand Up @@ -84,15 +80,29 @@ jobs:
with:
path: assets

- name: get wheel and tar.gz names
id: whl_targz_names
uses: ./.github/actions/nm_whl_tar_gz_names

# this workflow is only run if push-to-pypi is True, and we only
# want to push RELEASE assets to the external pypi.org
# publish the wheel file
- name: push wheel to pypi.org
# this workflow is only run if push-to-pypi is True, and we only
# want to push RELEASE wheels to the external pypi.org
if: ${{ inputs.wf_category }} == "RELEASE"
uses: neuralmagic/nm-actions/actions/publish_whl/action.yml@main
if: ${{ inputs.wf_category == "RELEASE" }}
uses: neuralmagic/nm-actions/actions/publish_whl/[email protected]
with:
username: ${{ secrets.PYPI_PUBLIC_USER }}
password: ${{ secrets.PYPI_PUBLIC_AUTH }}
whl: ${{ inputs.whl }}
whl: ${{ steps.whl_targz_names.outputs.whl }}

# publish the tar.gz file
- name: push tar.gz to pypi.org
if: ${{ inputs.wf_category == "RELEASE" }}
uses: neuralmagic/nm-actions/actions/publish_whl/[email protected]
with:
username: ${{ secrets.PYPI_PUBLIC_USER }}
password: ${{ secrets.PYPI_PUBLIC_AUTH }}
whl: ${{ steps.whl_targz_names.outputs.targz }}

# GCP
- name: 'Authenticate to Google Cloud'
Expand All @@ -111,6 +121,9 @@ jobs:
- name: cp assets
id: cp-assets
uses: ./.github/actions/nm-cp-assets/
with:
whl: ${{ steps.whl_targz_names.outputs.whl }}
targz: ${{ steps.whl_targz_names.outputs.targz }}

- name: trigger stratus nm-pypi update workflow to update nm-pypi index
uses: actions/github-script@v6
Expand Down

0 comments on commit ef34d58

Please sign in to comment.