Skip to content

Commit 72e3b49

Browse files
authored
fix(ci): release on ubuntu with wheels from previous steps (#1960)
* fix: release on ubuntu:24.04 with gh-action-pypi-publish Signed-off-by: Keming <kemingyang@tensorchord.ai> * test ghcr Signed-off-by: Keming <kemingyang@tensorchord.ai> --------- Signed-off-by: Keming <kemingyang@tensorchord.ai>
1 parent 7f31185 commit 72e3b49

File tree

1 file changed

+64
-50
lines changed

1 file changed

+64
-50
lines changed

.github/workflows/release.yml

Lines changed: 64 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: release
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
67

78
jobs:
89
goreleaser:
9-
if: github.repository == 'tensorchord/envd'
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
@@ -17,7 +17,7 @@ jobs:
1717
uses: actions/setup-go@v5
1818
with:
1919
go-version: 'stable'
20-
- name: Docker Login
20+
- name: Login to Docker
2121
uses: docker/login-action@v3
2222
with:
2323
username: ${{ secrets.DOCKERIO_USERNAME }}
@@ -39,56 +39,72 @@ jobs:
3939
dist/envd_linux_amd64_v1/envd
4040
dist/envd_darwin_all/envd
4141
if-no-files-found: error
42-
pypi_publish:
42+
python_build:
4343
needs: goreleaser
44-
# only trigger on main repo when tag starts with v
45-
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
4644
runs-on: ${{ matrix.os }}
47-
timeout-minutes: 20
48-
permissions:
49-
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
5045
strategy:
5146
matrix:
5247
os: [macos-13, ubuntu-22.04]
5348
steps:
54-
- uses: actions/checkout@v4
55-
- name: Get gobin
56-
uses: actions/download-artifact@v4
57-
with:
58-
name: gobin_${{ github.event.release.tag_name }}
59-
path: dist/
60-
- name: Configure linux build environment
61-
if: runner.os == 'Linux'
62-
run: |
63-
mkdir -p bin
64-
mv dist/envd_linux_amd64_v1/envd bin/envd
65-
chmod +x bin/envd
66-
- name: Configure macOS build environment
67-
if: runner.os == 'macOS'
68-
run: |
69-
mkdir -p bin
70-
mv dist/envd_darwin_all/envd bin/envd
71-
chmod +x bin/envd
72-
- name: setup Python
73-
uses: actions/setup-python@v5
74-
with:
75-
python-version: '3.11'
76-
- name: Build wheels
77-
uses: pypa/cibuildwheel@v2.22.0
78-
env:
79-
CIBW_ARCHS_MACOS: arm64, x86_64
80-
CIBW_ARCHS_LINUX: auto64
81-
CIBW_SKIP: pp*
82-
- name: Build source distribution
83-
if: runner.os == 'Linux' # Only release source under linux to avoid conflict
84-
run: |
85-
python -m pip install wheel
86-
python setup.py sdist
87-
mv dist/*.tar.gz wheelhouse/
88-
- name: Publish package distributions to PyPI
89-
run: |
90-
python -m pip install twine
91-
python -m twine upload --skip-existing wheelhouse/*
49+
- uses: actions/checkout@v4
50+
- name: Get gobin
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: gobin_${{ github.event.release.tag_name }}
54+
path: dist/
55+
- name: Configure linux build environment
56+
if: runner.os == 'Linux'
57+
run: |
58+
mkdir -p bin
59+
mv dist/envd_linux_amd64_v1/envd bin/envd
60+
chmod +x bin/envd
61+
- name: Configure macOS build environment
62+
if: runner.os == 'macOS'
63+
run: |
64+
mkdir -p bin
65+
mv dist/envd_darwin_all/envd bin/envd
66+
chmod +x bin/envd
67+
- name: setup Python
68+
uses: actions/setup-python@v5
69+
with:
70+
python-version: '3.11'
71+
- name: Build wheels
72+
uses: pypa/cibuildwheel@v2.22.0
73+
env:
74+
CIBW_ARCHS_MACOS: arm64, x86_64
75+
CIBW_ARCHS_LINUX: auto64
76+
CIBW_SKIP: pp*
77+
- name: Build source distribution
78+
if: runner.os == 'Linux' # Only release source under linux to avoid conflict
79+
run: |
80+
python -m pip install wheel
81+
python setup.py sdist
82+
mv dist/*.tar.gz wheelhouse/
83+
- name: Upload artifacts
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: pypi_${{ github.event.release.tag_name }}_${{ matrix.os }}
87+
path: wheelhouse/
88+
retention-days: 1
89+
pypi_publish:
90+
needs: python_build
91+
# only trigger on main repo when tag starts with v
92+
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
93+
runs-on: ubuntu-24.04
94+
permissions:
95+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
96+
steps:
97+
- name: Download artifacts
98+
uses: actions/download-artifact@v4
99+
with:
100+
pattern: pypi_${{ github.event.release.tag_name }}_*
101+
merge-multiple: true
102+
path: dist/
103+
- name: Upload to PyPI
104+
uses: pypa/gh-action-pypi-publish@release/v1
105+
with:
106+
skip-existing: true
107+
verbose: true
92108
image_publish:
93109
name: Build & push images
94110
# only trigger on main repo when tag starts with v
@@ -118,6 +134,8 @@ jobs:
118134
envd_starship_publish:
119135
name: Push starship image to Docker Hub
120136
runs-on: ubuntu-latest
137+
# only trigger on main repo when tag starts with v
138+
if: github.repository == 'tensorchord/envd' && startsWith(github.ref, 'refs/tags/v')
121139
needs: goreleaser
122140
steps:
123141
- uses: actions/checkout@v4
@@ -177,10 +195,6 @@ jobs:
177195
tag_suffix: ""
178196
- build_func: build_gpu_11_6
179197
tag_suffix: "-cuda-11.6.2-cudnn-8"
180-
- build_func: build_gpu_11_8
181-
tag_suffix: "-cuda-11.8.0-cudnn-8"
182-
- build_func: build_gpu_12_3
183-
tag_suffix: "-cuda-12.3.2-cudnn-9"
184198
needs: image_publish
185199
steps:
186200
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)