Add GH action for build and uploading wheel #11
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
name: Build | |
on: [push] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install build requirements | |
run: | | |
sudo apt-get update && sudo apt-get install -y jq nodejs | |
- name: Build wheel | |
run: | | |
make build-wheel | |
- name: Test tag and version consistency | |
id: test_consistency | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
tests/test-version-tag | |
echo "VERSION=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT" | |
- name: Create release | |
id: create_release | |
if: startsWith(github.ref, 'refs/tags/v') && steps.test_consistency.outcome == 'success' | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Version ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
- name: Upload release wheel | |
id: upload_release | |
if: steps.create_release.outcome == 'success' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/jupyterlab_custom_order-${{ steps.test_consistency.outputs.VERSION }}-py3-none-any.whl | |
asset_name: jupyterlab_custom_order-${{ steps.test_consistency.outputs.VERSION }}-py3-none-any.whl | |
asset_content_type: application/whl |