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

ci: Include distribution assets in each GitHub release #32

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,5 @@ jobs:
if: always()
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems to be the default, as it seems to be safe to drop this line.

file: coveralls.lcov
format: lcov
55 changes: 38 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,63 @@ on:

jobs:

build:
name: build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
Copy link
Member Author

Choose a reason for hiding this comment

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

Should specify Python 3.12 here explicitly. When Python 3.13 is released, there may be a short time before symengine wheels are available, and we don't want releases to fail in the meantime.

For this reason we really ought also to run this "build" step upon every push to main, as suggested in the pypa docs.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, those seem like reasonable ideas. Having this run on main should work if we loosen the run conditions at the top of this file but restrict the conditions for the second and third job in here.

uses: actions/setup-python@v5
- name: Install pypa/build tool
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build distribution
run: |
python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

github:
name: github
name: publish to github
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout tag
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Download all the dists
uses: actions/download-artifact@v4
with:
ref: ${{ github.ref_name }}
Copy link
Member Author

Choose a reason for hiding this comment

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

Likewise, not necessary to specify.

name: python-package-distributions
path: dist/
- name: Publish release
uses: ghalactic/github-release-from-tag@v5
if: github.ref_type == 'tag'
with:
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: "true"
assets: |
- path: dist/*

pypi:
name: pypi
name: publish to pypi
runs-on: ubuntu-latest
needs: github
needs:
- build
- github
environment:
name: pypi
url: https://pypi.org/p/qiskit-addon-utils
permissions:
id-token: write
steps:
- name: Checkout tag
uses: actions/checkout@v4
- name: Download all the dists
uses: actions/download-artifact@v4
with:
ref: ${{ github.ref_name }}
- name: Install `build` tool
run: |
python -m pip install --upgrade pip
pip install build
- name: Build distribution
run: |
python -m build
name: python-package-distributions
path: dist/
- name: Publish release to PyPI
uses: pypa/gh-action-pypi-publish@release/v1