Skip to content

Commit ef82e6c

Browse files
committed
update github workflow
1 parent a4d1275 commit ef82e6c

2 files changed

Lines changed: 82 additions & 20 deletions

File tree

.github/workflows/release.yml

Lines changed: 81 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,107 @@
11
name: Release Workflow
2+
permissions: {}
23

34
on:
45
push:
56
tags:
67
- "*"
78

89
jobs:
9-
build:
10-
name: Build wheel and create release
10+
lint:
11+
name: Linters
1112
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read # Fetch repository
15+
security-events: write # Required for upload-sarif (used by zizmor-action) to upload SARIF files.
1216
steps:
1317
- name: Checkout code
1418
uses: actions/checkout@v4
19+
with:
20+
persist-credentials: false
21+
22+
- name: zizmor
23+
uses: zizmorcore/zizmor-action@e639db99335bc9038abc0e066dfcd72e23d26fb4 # v0.3.0
24+
25+
- name: typos
26+
uses: crate-ci/typos@2d0ce569feab1f8752f1dde43cc2f2aa53236e06 # v1.40.0
1527

16-
- name: Linter
17-
uses: astral-sh/ruff-action@v3
28+
- name: Ruff
29+
uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
1830

19-
- name: Get tag name
20-
id: get_tag
21-
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
31+
build:
32+
name: Build distribution
33+
runs-on: ubuntu-latest
34+
needs: lint
35+
permissions:
36+
contents: read # Fetch repository
37+
actions: write # Upload artifact
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
with:
42+
persist-credentials: false
2243

2344
- name: Install uv
24-
uses: astral-sh/setup-uv@v5
45+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
2546
with:
2647
version: "latest"
48+
enable-cache: false
2749

28-
- name: Build wheel
50+
- name: Build wheel and sdist
2951
run: uv build
3052

31-
- name: Upload artifacts
32-
uses: actions/upload-artifact@v4
53+
- name: Upload dists
54+
uses: actions/upload-artifact@v5
3355
with:
34-
name: dist-${{ matrix.os }}
35-
path: ./dist/*
56+
name: python-package-distributions
57+
path: dist/
3658

37-
- name: Create Release
38-
env:
39-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
TAG: ${{ steps.get_tag.outputs.TAG_NAME }}
41-
run: gh release create "$TAG" ./dist/*
59+
publish-to-pypi:
60+
name: Publish to PyPI
61+
runs-on: ubuntu-latest
62+
needs: build
63+
environment:
64+
name: publish-to-pypi
65+
permissions:
66+
actions: read # Download artifact
67+
id-token: write # Needed for trusted publishing
68+
steps:
69+
- name: Download all dists
70+
uses: actions/download-artifact@v6
71+
with:
72+
name: python-package-distributions
73+
path: dist/
74+
75+
- name: Install uv
76+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
77+
with:
78+
version: "latest"
79+
enable-cache: false
4280

4381
- name: Upload to PyPI
44-
run: uv publish -t ${{ secrets.UV_PUBLISH_TOKEN }}
82+
run: uv publish --trusted-publishing always
83+
84+
85+
github-release:
86+
name: GitHub release
87+
runs-on: ubuntu-latest
88+
needs: build
89+
permissions:
90+
actions: read # Download artifact
91+
contents: write # Create GitHub release
92+
steps:
93+
- name: Checkout code
94+
uses: actions/checkout@v4
95+
with:
96+
persist-credentials: false
4597

98+
- name: Download all dists
99+
uses: actions/download-artifact@v6
100+
with:
101+
name: python-package-distributions
102+
path: ./dist/
103+
104+
- name: Create release
105+
env:
106+
GITHUB_TOKEN: ${{ github.token }}
107+
run: gh release create "${GITHUB_REF#refs/tags/}" ./dist/*

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The naive PyTorch backend for the k-NN is enough to compute the MAP over words q
1616

1717
You might want to use the Faiss backend if you compute the MAP over n-grams or if have a large number of
1818
embeddings. In this case, since Faiss is not available on PyPI, you can install this package in a pixi or conda
19-
environment. We recommand using pixi on Linux: clone this repository and run `pixi shell -e faiss-cpu` or
19+
environment. We recommend using pixi on Linux: clone this repository and run `pixi shell -e faiss-cpu` or
2020
`pixi shell -e faiss-gpu`.
2121

2222
With conda, first install Faiss in your conda environment (be careful about your PyTorch and Faiss versions,

0 commit comments

Comments
 (0)