Skip to content

Commit

Permalink
Update GHA to use gh to create release
Browse files Browse the repository at this point in the history
Added Python 3.11 testing, and use build package to build packages.
  • Loading branch information
blowekamp committed May 11, 2023
1 parent d3d3d1a commit d441296
Showing 1 changed file with 10 additions and 48 deletions.
58 changes: 10 additions & 48 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v3
Expand All @@ -56,14 +56,7 @@ jobs:
pip install -r requirements.txt -r requirements-dev.txt
- name: Test with pytest
run: |
python -m pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
python -m pytest
package_docs:
needs: test
Expand All @@ -79,11 +72,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt -r requirements-dev.txt -r docs/requirements.txt
python -m pip install wheel
python -m pip install -r requirements.txt -r docs/requirements.txt twine build
- name: Build package
run: |
python setup.py sdist bdist_wheel
python -m build --wheel --sdist
python -m twine check dist/*
ls -la dist
- name: Upload package
if: github.event_name == 'push'
Expand Down Expand Up @@ -126,42 +119,11 @@ jobs:
id: download
with:
name: python-packages
- name: Extract Python Packages
id: files
run: |
cd ${{steps.download.outputs.download-path}}
echo ::set-output name=file1::$(ls sitkibex*any.whl)
echo ::set-output name=file2::$(ls sitkibex*.tar.gz)
- name: Create Release
- name: Create Release and Upload
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset Wheel
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include
# a `upload_url`. See this blog post for more info:
# https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{steps.download.outputs.download-path}}/${{steps.files.outputs.file1}}
asset_name: ${{steps.files.outputs.file1}}
asset_content_type: application/octet-stream
- name: Upload Release Asset Source
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{steps.download.outputs.download-path}}/${{steps.files.outputs.file2}}
asset_name: ${{steps.files.outputs.file2}}
asset_content_type: application/octet-stream
run: |
gh release create ${{ github.ref_name }} --repo ${{ github.repository }} --verify-tag --generate-notes --title "Release ${{ github.ref_name }}"
gh release upload ${{ github.ref_name }} --repo ${{ github.repository }} ${{steps.download.outputs.download-path}}/*

0 comments on commit d441296

Please sign in to comment.