Fix version detection in workflows

Also fix error in ROCm release workflow
This commit is contained in:
jllllll
2023-10-13 16:52:13 -05:00
parent 283957acbe
commit bcb283c89f
2 changed files with 37 additions and 35 deletions

View File

@@ -2,12 +2,12 @@ name: Build ROCm 5.6 Wheels & Release
on:
workflow_dispatch:
inputs:
pypi:
description: 'Upload wheels to PyPI? 1 = yes, 0 = no'
default: '0'
required: true
type: string
# inputs:
# pypi:
# description: 'Upload wheels to PyPI? 1 = yes, 0 = no'
# default: '0'
# required: true
# type: string
workflow_call:
inputs:
pypi:
@@ -67,12 +67,13 @@ jobs:
- name: Build Wheel
id: build-wheel
run: |
if ($(Get-Content 'setup.py' -raw) -match 'version = "(\d+\.(?:\d+\.?)*)" \+ \(')
$versionString = Get-Content $(Join-Path 'exllamav2' 'version.py') -raw
if ($versionString -match '__version__ = "(\d+\.(?:\d+\.?(?:dev\d+)?)*)"')
{
Write-Output $('::notice file=build-wheels-release-rocm.yml,line=72,title=Package Version::Detected package version is: {0}' -f $Matches[1])
Write-Output $('::notice file=build-wheels-release-rocm.yml,line=73,title=Package Version::Detected package version is: {0}' -f $Matches[1])
Write-Output "PACKAGE_VERSION=$($Matches[1])" >> "$env:GITHUB_OUTPUT"
} else {
Write-Output '::error file=build-wheels-release.yml,line=75::Could not parse version from setup.py! You must upload wheels manually!'
Write-Output '::error file=build-wheels-release.yml,line=76::Could not parse version from exllamav2/version.py! You must upload wheels manually!'
Write-Output "PACKAGE_VERSION=None" >> "$env:GITHUB_OUTPUT"
}
@@ -90,28 +91,28 @@ jobs:
uses: svenstaro/upload-release-action@2.6.1
with:
file: ./dist/*.whl
tag: ${{ steps.build-wheel.outputs.PACKAGE_VERSION }}
tag: ${{ format('v{0}', steps.build-wheel.outputs.PACKAGE_VERSION) }}
file_glob: true
overwrite: true
release_name: ${{ steps.build-wheel.outputs.PACKAGE_VERSION }}
publish-to-pypi:
name: Publish Python distribution to PyPI
if: inputs.pypi == '1' && github.event_name != 'workflow_call'
needs: ['build_wheels','build_rocm']
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/exllamav2
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.10
# publish-to-pypi:
# name: Publish Python distribution to PyPI
# if: inputs.pypi == '1' && github.event_name != 'workflow_call'
# needs: ['build_wheels']
# runs-on: ubuntu-latest
#
# environment:
# name: pypi
# url: https://pypi.org/p/exllamav2
# permissions:
# id-token: write # IMPORTANT: mandatory for trusted publishing
#
# steps:
# - name: Download all the wheels
# uses: actions/download-artifact@v3
# with:
# name: wheels
# path: dist/
# - name: Publish distribution to PyPI
# uses: pypa/gh-action-pypi-publish@v1.8.10