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

Add wheels.yml workflow for release to PyPI #106

Merged
merged 1 commit into from
Nov 6, 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
65 changes: 65 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build and maybe upload to PyPI

on:
push:
pull_request:
Comment on lines +4 to +5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually have to run on push/pull_request? I would expect release to be sufficient. push maybe but only for main?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya, I did that because the actual uploading does a check for tags being present.

if: "startsWith(github.ref, 'refs/tags/')"

Thought maybe it'd be useful to ensure the project builds successfully, but maybe it's overkill.

release:
types:
- released
- prereleased

jobs:
artifacts:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
run: pip wheel . -w dist
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: ./dist/dask_glm*

list_artifacts:
name: List build artifacts
needs: [artifacts]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifacts
path: dist
- name: test
run: |
ls
ls dist

upload_pypi:
needs: [artifacts]
if: "startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest
environment:
name: releases
url: https://pypi.org/p/dask-glm
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: artifacts
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
skip-existing: true
Loading