Skip to content

Commit

Permalink
fix(ci): release on ubuntu with wheels from previous steps (#1960)
Browse files Browse the repository at this point in the history
* fix: release on ubuntu:24.04 with gh-action-pypi-publish

Signed-off-by: Keming <[email protected]>

* test ghcr

Signed-off-by: Keming <[email protected]>

---------

Signed-off-by: Keming <[email protected]>
  • Loading branch information
kemingy authored Jan 20, 2025
1 parent 7f31185 commit 72e3b49
Showing 1 changed file with 64 additions and 50 deletions.
114 changes: 64 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: release
on:
release:
types: [published]
workflow_dispatch:

jobs:
goreleaser:
if: github.repository == 'tensorchord/envd'
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Docker Login
- name: Login to Docker
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERIO_USERNAME }}
Expand All @@ -39,56 +39,72 @@ jobs:
dist/envd_linux_amd64_v1/envd
dist/envd_darwin_all/envd
if-no-files-found: error
pypi_publish:
python_build:
needs: goreleaser
# only trigger on main repo when tag starts with v
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
runs-on: ${{ matrix.os }}
timeout-minutes: 20
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
strategy:
matrix:
os: [macos-13, ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Get gobin
uses: actions/download-artifact@v4
with:
name: gobin_${{ github.event.release.tag_name }}
path: dist/
- name: Configure linux build environment
if: runner.os == 'Linux'
run: |
mkdir -p bin
mv dist/envd_linux_amd64_v1/envd bin/envd
chmod +x bin/envd
- name: Configure macOS build environment
if: runner.os == 'macOS'
run: |
mkdir -p bin
mv dist/envd_darwin_all/envd bin/envd
chmod +x bin/envd
- name: setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_MACOS: arm64, x86_64
CIBW_ARCHS_LINUX: auto64
CIBW_SKIP: pp*
- name: Build source distribution
if: runner.os == 'Linux' # Only release source under linux to avoid conflict
run: |
python -m pip install wheel
python setup.py sdist
mv dist/*.tar.gz wheelhouse/
- name: Publish package distributions to PyPI
run: |
python -m pip install twine
python -m twine upload --skip-existing wheelhouse/*
- uses: actions/checkout@v4
- name: Get gobin
uses: actions/download-artifact@v4
with:
name: gobin_${{ github.event.release.tag_name }}
path: dist/
- name: Configure linux build environment
if: runner.os == 'Linux'
run: |
mkdir -p bin
mv dist/envd_linux_amd64_v1/envd bin/envd
chmod +x bin/envd
- name: Configure macOS build environment
if: runner.os == 'macOS'
run: |
mkdir -p bin
mv dist/envd_darwin_all/envd bin/envd
chmod +x bin/envd
- name: setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_MACOS: arm64, x86_64
CIBW_ARCHS_LINUX: auto64
CIBW_SKIP: pp*
- name: Build source distribution
if: runner.os == 'Linux' # Only release source under linux to avoid conflict
run: |
python -m pip install wheel
python setup.py sdist
mv dist/*.tar.gz wheelhouse/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pypi_${{ github.event.release.tag_name }}_${{ matrix.os }}
path: wheelhouse/
retention-days: 1
pypi_publish:
needs: python_build
# only trigger on main repo when tag starts with v
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: pypi_${{ github.event.release.tag_name }}_*
merge-multiple: true
path: dist/
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
image_publish:
name: Build & push images
# only trigger on main repo when tag starts with v
Expand Down Expand Up @@ -118,6 +134,8 @@ jobs:
envd_starship_publish:
name: Push starship image to Docker Hub
runs-on: ubuntu-latest
# only trigger on main repo when tag starts with v
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
needs: goreleaser
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -177,10 +195,6 @@ jobs:
tag_suffix: ""
- build_func: build_gpu_11_6
tag_suffix: "-cuda-11.6.2-cudnn-8"
- build_func: build_gpu_11_8
tag_suffix: "-cuda-11.8.0-cudnn-8"
- build_func: build_gpu_12_3
tag_suffix: "-cuda-12.3.2-cudnn-9"
needs: image_publish
steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit 72e3b49

Please sign in to comment.