Skip to content

Commit

Permalink
Codechange: [Actions] Use 'gh' to upload release assets (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
glx22 authored May 14, 2023
1 parent 7237f01 commit 9627312
Showing 1 changed file with 7 additions and 29 deletions.
36 changes: 7 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,11 @@ jobs:
- name: Build and publish wheel and source distribution
env:
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload --username __token__ dist/*.whl dist/*.tar.gz
version=`python setup.py --version`
archive=`echo "nml-$version.tar.gz"`
echo "archive=$archive" >> $GITHUB_OUTPUT
id: nml_source_archive

- name: Publish source tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/${{ steps.nml_source_archive.outputs.archive }}
asset_name: ${{ steps.nml_source_archive.outputs.archive }}
asset_content_type: application/gzip
gh release upload ${{ github.event.release.tag_name }} dist/*.tar.gz
release-windows:
name: Windows release
Expand Down Expand Up @@ -131,21 +119,11 @@ jobs:
python setup.py bdist_wheel
twine upload --username __token__ dist/*.whl
- name: Build standalone executable
- name: Build and publish standalone executable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pyinstaller nmlc.spec
$version = python setup.py --version
$archive = echo "nml-standalone-$version-win64.zip"
$archive = "nml-standalone-${{ github.event.release.tag_name }}-win64.zip"
Compress-Archive -Path dist/nmlc.exe, LICENSE, README.md, docs/changelog.txt -DestinationPath $archive
echo "archive=$archive" >> $GITHUB_OUTPUT
id: nml_archive

- name: Publish standalone executable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.nml_archive.outputs.archive }}
asset_name: ${{ steps.nml_archive.outputs.archive }}
asset_content_type: application/zip
gh release upload ${{ github.event.release.tag_name }} $archive

0 comments on commit 9627312

Please sign in to comment.