-
Notifications
You must be signed in to change notification settings - Fork 7k
[ci] simplify release workflow. #13329
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
Merged
+47
−124
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
97ddfcd
simplify release workflow.
sayakpaul 6194eac
up
sayakpaul dc5cd04
Merge branch 'main' into overhaul-release-workflow
sayakpaul 9106e6f
Merge branch 'main' into overhaul-release-workflow
sayakpaul d2a42da
Merge branch 'main' into overhaul-release-workflow
sayakpaul 597e600
trigger on branches too.
sayakpaul 03ac8b7
restrict permissions to read.
sayakpaul c8deb35
use sha
sayakpaul 94eddf6
remove determination step of latest branch
sayakpaul f5232f8
resolve rest
sayakpaul efbdb4b
Merge branch 'main' into overhaul-release-workflow
sayakpaul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,82 +1,78 @@ | ||||||
| # Adapted from https://blog.deepjyoti30.dev/pypi-release-github-action | ||||||
|
|
||||||
| name: PyPI release | ||||||
|
|
||||||
| on: | ||||||
| workflow_dispatch: | ||||||
| push: | ||||||
| tags: | ||||||
| - "*" | ||||||
| - v* | ||||||
| branches: | ||||||
| - 'v*-release' | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
|
|
||||||
|
sayakpaul marked this conversation as resolved.
|
||||||
| jobs: | ||||||
| find-and-checkout-latest-branch: | ||||||
| build-and-test: | ||||||
| runs-on: ubuntu-22.04 | ||||||
| outputs: | ||||||
| latest_branch: ${{ steps.set_latest_branch.outputs.latest_branch }} | ||||||
| steps: | ||||||
| - name: Checkout Repo | ||||||
| uses: actions/checkout@v6 | ||||||
| - name: Checkout repo | ||||||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||||||
|
|
||||||
| - name: Set up Python | ||||||
| uses: actions/setup-python@v6 | ||||||
| with: | ||||||
| python-version: '3.10' | ||||||
|
|
||||||
| - name: Fetch latest branch | ||||||
| id: fetch_latest_branch | ||||||
| run: | | ||||||
| pip install -U requests packaging | ||||||
| LATEST_BRANCH=$(python utils/fetch_latest_release_branch.py) | ||||||
| echo "Latest branch: $LATEST_BRANCH" | ||||||
| echo "latest_branch=$LATEST_BRANCH" >> $GITHUB_ENV | ||||||
|
|
||||||
| - name: Set latest branch output | ||||||
| id: set_latest_branch | ||||||
| run: echo "::set-output name=latest_branch::${{ env.latest_branch }}" | ||||||
|
|
||||||
| release: | ||||||
| needs: find-and-checkout-latest-branch | ||||||
| runs-on: ubuntu-22.04 | ||||||
|
|
||||||
| steps: | ||||||
| - name: Checkout Repo | ||||||
| uses: actions/checkout@v6 | ||||||
| with: | ||||||
| ref: ${{ needs.find-and-checkout-latest-branch.outputs.latest_branch }} | ||||||
|
|
||||||
| - name: Setup Python | ||||||
| uses: actions/setup-python@v6 | ||||||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | ||||||
| with: | ||||||
| python-version: "3.10" | ||||||
|
|
||||||
| - name: Install dependencies | ||||||
| - name: Install build dependencies | ||||||
| run: | | ||||||
| python -m pip install --upgrade pip | ||||||
| pip install -U setuptools wheel twine | ||||||
| pip install -U build | ||||||
| pip install -U torch --index-url https://download.pytorch.org/whl/cpu | ||||||
|
|
||||||
| - name: Build the dist files | ||||||
| run: python setup.py bdist_wheel && python setup.py sdist | ||||||
| run: python -m build | ||||||
|
|
||||||
|
sayakpaul marked this conversation as resolved.
|
||||||
| - name: Validate dist metadata | ||||||
| run: | | ||||||
| pip install twine | ||||||
| twine check --strict dist/* | ||||||
|
|
||||||
| - name: Publish to the test PyPI | ||||||
| env: | ||||||
| TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }} | ||||||
| TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} | ||||||
| run: twine upload dist/* -r pypitest --repository-url=https://test.pypi.org/legacy/ | ||||||
| - name: Install from built wheel | ||||||
| run: pip install dist/*.whl | ||||||
|
|
||||||
| - name: Test installing diffusers and importing | ||||||
| run: | | ||||||
| pip install diffusers && pip uninstall diffusers -y | ||||||
| pip install -i https://test.pypi.org/simple/ diffusers | ||||||
| pip install -U transformers | ||||||
| python utils/print_env.py | ||||||
| python -c "from diffusers import __version__; print(__version__)" | ||||||
| python -c "from diffusers import DiffusionPipeline; pipe = DiffusionPipeline.from_pretrained('fusing/unet-ldm-dummy-update'); pipe()" | ||||||
| python -c "from diffusers import DiffusionPipeline; pipe = DiffusionPipeline.from_pretrained('hf-internal-testing/tiny-stable-diffusion-pipe', safety_checker=None); pipe('ah suh du')" | ||||||
| python -c "from diffusers import *" | ||||||
|
|
||||||
| - name: Publish to PyPI | ||||||
| env: | ||||||
| TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||||||
| TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||||||
| run: twine upload dist/* -r pypi | ||||||
| - name: Upload build artifacts | ||||||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | ||||||
| with: | ||||||
| name: python-dist | ||||||
| path: dist/ | ||||||
|
|
||||||
| publish-to-pypi: | ||||||
| needs: build-and-test | ||||||
| if: startsWith(github.ref, 'refs/tags/') | ||||||
| runs-on: ubuntu-latest | ||||||
| environment: pypi-release | ||||||
| permissions: | ||||||
| id-token: write | ||||||
|
|
||||||
| steps: | ||||||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||||||
|
|
||||||
| - name: Download build artifacts | ||||||
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | ||||||
| with: | ||||||
| name: python-dist | ||||||
| path: dist/ | ||||||
|
|
||||||
| - name: Publish package distributions to TestPyPI | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1 | ||||||
| with: | ||||||
| verbose: true | ||||||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realised we use v*-patch for patch branch names. Not a merge blocker, I would actually prefer it if we just called everything v*-release like transformers moving forward.