Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codechange: [Actions] Use 'gh' to upload release assets #284

Merged
merged 1 commit into from
May 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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