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

chore: update the release workflow #627

Merged
merged 1 commit into from
Aug 20, 2024
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
58 changes: 44 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,59 @@
name: Publish

on:
push:
tags:
- '*'
workflow_dispatch:
release:
types: [published]

env:
PIP_DISABLE_PIP_VERSION_CHECK: '1'
PY_COLORS: '1'
FORCE_COLOR: '3'

jobs:
publish:
build:
name: Build sdist and wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout repository

- uses: actions/setup-python@v5.1.1
with:
python-version: '3.10'
python-version: "3.12"

- name: Install build tools
run: |
python -m pip install build twine wheel
- name: Build package
run: python -m build
- name: Upload to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
pipx run build --outdir dist

- name: Upload wheel and sdist artifacts
uses: actions/upload-artifact@v4.3.6
with:
name: artifacts
path: ./dist/*
if-no-files-found: error

publish:
needs: [build]
name: Upload to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/autograd
permissions:
id-token: write # mandatory for trusted publishing

steps:
- name: Download artifacts
uses: actions/download-artifact@v4.1.8
with:
path: dist
merge-multiple: true

- name: Sanity check artifacts
run: ls -la dist/

- name: Publish sdist and wheel to PyPI
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0
with:
repository-url: https://pypi.org/p/autograd
packages-dir: dist/