Skip to content

Commit 17d18b9

Browse files
authored
ci: Update build workflow (#1118)
1 parent 833c8f0 commit 17d18b9

3 files changed

Lines changed: 63 additions & 42 deletions

File tree

.github/workflows/build.yaml

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
- "v[0-9]+.[0-9]+.[0-9]+a[0-9]+"
77
- "v[0-9]+.[0-9]+.[0-9]+b[0-9]+"
88
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
9-
# Dry-run only
109
workflow_dispatch:
1110
schedule:
1211
- cron: "0 13 * * SUN"
@@ -16,8 +15,8 @@ defaults:
1615
shell: bash -e {0}
1716

1817
env:
19-
PYTHON_VERSION: "3.11"
2018
PACKAGE: "param"
19+
PYTHON_VERSION: "3.10"
2120

2221
jobs:
2322
waiting_room:
@@ -48,45 +47,35 @@ jobs:
4847
install: false
4948
- name: conda build
5049
run: pixi run -e build build-conda
51-
- uses: actions/upload-artifact@v4
50+
- uses: actions/upload-artifact@v7
5251
if: always()
5352
with:
54-
name: conda
55-
path: dist/*.tar.bz2
53+
name: artifacts-conda
54+
path: dist/*.conda
5655
if-no-files-found: error
5756

5857
conda_publish:
5958
name: Publish Conda
6059
runs-on: ubuntu-latest
6160
needs: [conda_build, waiting_room]
6261
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
63-
defaults:
64-
run:
65-
shell: bash -el {0}
6662
steps:
67-
- uses: actions/download-artifact@v4
63+
- uses: actions/download-artifact@v8
6864
with:
69-
name: conda
65+
name: artifacts-conda
7066
path: dist/
71-
- name: Set environment variables
67+
- name: anaconda setup
7268
run: |
73-
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
74-
echo "CONDA_FILE=$(ls dist/*.tar.bz2)" >> $GITHUB_ENV
75-
- uses: conda-incubator/setup-miniconda@v3
76-
with:
77-
miniconda-version: "latest"
78-
channel: "conda-forge"
79-
- name: conda setup
80-
run: |
81-
conda install -y anaconda-client
82-
- name: conda dev upload
83-
if: contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc')
69+
pipx install anaconda-client
70+
binstar --version
71+
- name: anaconda dev upload
72+
if: contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc')
8473
run: |
85-
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev $CONDA_FILE
86-
- name: conda main upload
87-
if: (!(contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc')))
74+
binstar --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev dist/*.conda
75+
- name: anaconda upload
76+
if: (!(contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc')))
8877
run: |
89-
anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev --label=main $CONDA_FILE
78+
binstar --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev --label=main dist/*.conda
9079
9180
pip_build:
9281
name: Build PyPI
@@ -100,10 +89,10 @@ jobs:
10089
install: false
10190
- name: Build package
10291
run: pixi run -e build build-pip
103-
- uses: actions/upload-artifact@v4
92+
- uses: actions/upload-artifact@v7
10493
if: always()
10594
with:
106-
name: pip
95+
name: artifacts-pip
10796
path: dist/
10897
if-no-files-found: error
10998

@@ -112,12 +101,12 @@ jobs:
112101
runs-on: "ubuntu-latest"
113102
needs: [pip_build]
114103
steps:
115-
- uses: actions/setup-python@v5
104+
- uses: actions/setup-python@v6
116105
with:
117106
python-version: ${{ env.PYTHON_VERSION }}
118-
- uses: actions/download-artifact@v4
107+
- uses: actions/download-artifact@v8
119108
with:
120-
name: pip
109+
name: artifacts-pip
121110
path: dist/
122111
- name: Install package
123112
run: python -m pip install dist/*.whl
@@ -129,14 +118,46 @@ jobs:
129118
runs-on: ubuntu-latest
130119
needs: [pip_build, waiting_room]
131120
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
121+
permissions:
122+
id-token: write
132123
steps:
133-
- uses: actions/download-artifact@v4
124+
- uses: actions/download-artifact@v8
134125
with:
135-
name: pip
126+
name: artifacts-pip
136127
path: dist/
137128
- name: Publish to PyPI
138129
uses: pypa/gh-action-pypi-publish@release/v1
130+
131+
announce:
132+
name: Announce GitHub
133+
runs-on: ubuntu-latest
134+
needs: [waiting_room]
135+
permissions:
136+
contents: write
137+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
138+
env:
139+
TAG: ${{ github.ref_name }}
140+
steps:
141+
- uses: actions/checkout@v6
142+
- uses: actions/download-artifact@v8
139143
with:
140-
user: ${{ secrets.PPU }}
141-
password: ${{ secrets.PPP }}
142-
repository-url: "https://upload.pypi.org/legacy/"
144+
pattern: artifacts-*
145+
path: artifacts/
146+
merge-multiple: true
147+
- name: Extract changelog section
148+
run: |
149+
awk -v ver="## Version ${TAG#v}" '
150+
$0 == ver {flag=1; next}
151+
/^## Version / && flag {exit}
152+
flag && !/^(\*\*.*\*\*)$/ && !/^Date:/
153+
' doc/releases.md | tee RELEASE_BODY.md
154+
- name: Create draft GitHub release with dist artifacts
155+
if: (!(contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc')))
156+
env:
157+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
158+
run: |
159+
gh release create "$TAG" \
160+
--title "Version ${TAG#v}" \
161+
--notes-file RELEASE_BODY.md \
162+
--draft \
163+
artifacts/*

.github/workflows/test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
- name: Test Examples
113113
run: |
114114
pixi run -e ${{ matrix.environment }} test-example
115-
- uses: codecov/codecov-action@v4
115+
- uses: codecov/codecov-action@v5
116116
with:
117117
token: ${{ secrets.CODECOV_TOKEN }}
118118

@@ -145,16 +145,16 @@ jobs:
145145
python-version: ["pypy3.11"]
146146
timeout-minutes: 30
147147
steps:
148-
- uses: actions/checkout@v4
148+
- uses: actions/checkout@v6
149149
with:
150150
fetch-depth: "100"
151151
- name: Fetch
152152
run: git fetch --prune --tags -f
153-
- uses: actions/setup-python@v5
153+
- uses: actions/setup-python@v6
154154
with:
155155
python-version: ${{ matrix.python-version }}
156156
- name: Install the latest version of uv
157-
uses: astral-sh/setup-uv@v5
157+
uses: astral-sh/setup-uv@v7
158158
- name: Create virtual environment
159159
run: uv venv --python ${{ matrix.python-version }}
160160
- name: Install project dependencies

scripts/conda/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ python -m build --sdist .
99
VERSION=$(python -c "import $PACKAGE; print($PACKAGE._version.__version__)")
1010
export VERSION
1111

12-
conda build scripts/conda/recipe --no-anaconda-upload --no-verify -c conda-forge --package-format 1
12+
conda build scripts/conda/recipe --no-anaconda-upload --no-verify -c conda-forge --package-format 2
1313

14-
mv "$CONDA_PREFIX/conda-bld/noarch/$PACKAGE-$VERSION-py_0.tar.bz2" dist
14+
mv "$CONDA_PREFIX/conda-bld/noarch/$PACKAGE-$VERSION-py_0.conda" dist

0 commit comments

Comments
 (0)