Skip to content

Commit f0cf207

Browse files
author
jgovindan
committed
2 parents 901464e + b5158f8 commit f0cf207

13 files changed

Lines changed: 469 additions & 50 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG]"
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Additional context**
32+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: "[FEATURE]"
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "docker"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"
11+
- package-ecosystem: "pip"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717
with:
18+
fetch-tags: true
1819
fetch-depth: 0
1920

2021
- name: Install uv
Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
name: Release
22

33
on:
4-
[ workflow_dispatch, push, pull_request ]
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
# workflow_dispatch:
13+
# inputs:
14+
# tag:
15+
# description: 'Tag to create'
16+
# required: true
17+
# default: 'v0.0.0'
18+
# version:
19+
# description: 'Version to create'
20+
# required: true
21+
# default: '0.0.0'
522
permissions:
623
pull-requests: read
724
contents: read
@@ -15,6 +32,7 @@ jobs:
1532
outputs:
1633
generated_version: ${{ steps.output-generated-version.outputs.generated_version }}
1734
image_tag: ${{ steps.generate_tag.outputs.image_tag }}
35+
image_tag_latest: ${{ steps.generate_tag.outputs.image_tag_latest }}
1836
tag_prefix: ${{ steps.generate_tag.outputs.tag_prefix }}
1937
permissions:
2038
contents: write
@@ -24,6 +42,7 @@ jobs:
2442
name: Checkout
2543
uses: actions/checkout@v4
2644
with:
45+
fetch-tags: true
2746
fetch-depth: 0
2847
-
2948
name: Generate next version
@@ -41,8 +60,8 @@ jobs:
4160
echo "generated_version=${{ steps.semantic-version.outputs.version }}" >> $GITHUB_OUTPUT
4261
4362
-
44-
name: Version tag ${{ steps.semantic-version.outputs.version }} on main branch
45-
if: ${{ github.ref == 'refs/heads/main' }}
63+
name: Version tag ${{ steps.semantic-version.outputs.version }} on main branch or tag
64+
if: ${{ github.ref == 'refs/heads/main' }} || startsWith(github.ref, 'refs/tags/v')
4665
shell: bash
4766
run: |
4867
echo "generated_tag=${{ steps.semantic-version.outputs.version }}" >> $GITHUB_ENV
@@ -66,6 +85,7 @@ jobs:
6685
# image tag needs to be all lower case
6786
repo_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
6887
echo "image_tag=${{ env.OCI_REGISTRY }}/${repo_name}:${{ env.generated_tag }}" >> $GITHUB_OUTPUT
88+
echo "image_tag_latest=${{ env.OCI_REGISTRY }}/${repo_name}:latest" >> $GITHUB_OUTPUT
6989
7090
docker-image-release:
7191
needs: [generate-release-version]
@@ -83,7 +103,7 @@ jobs:
83103
-
84104
uses: actions/checkout@v4
85105
-
86-
uses: docker/setup-docker-action@v4.1.0
106+
uses: docker/setup-docker-action@v4.3.0
87107
-
88108
name: Login to GitHub Container Registry
89109
uses: docker/login-action@v3
@@ -100,12 +120,12 @@ jobs:
100120
docker image inspect ${{ needs.generate-release-version.outputs.image_tag }}-${{ runner.arch }}
101121
-
102122
name: Push image for ${{ matrix.os }}
103-
if: github.event_name != 'pull_request'
123+
if: startsWith(github.ref, 'refs/tags/v')
104124
run: |
105125
docker push ${{ needs.generate-release-version.outputs.image_tag }}-${{ runner.arch }}
106126
107-
create-release:
108-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
127+
create-image-release:
128+
if: startsWith(github.ref, 'refs/tags/v')
109129
permissions:
110130
packages: write
111131
id-token: write
@@ -119,7 +139,7 @@ jobs:
119139
-
120140
uses: actions/checkout@v4
121141
-
122-
uses: docker/setup-docker-action@v4.1.0
142+
uses: docker/setup-docker-action@v4.3.0
123143
-
124144
name: Login to GitHub Container Registry
125145
uses: docker/login-action@v3
@@ -136,19 +156,11 @@ jobs:
136156
--amend ${{ needs.generate-release-version.outputs.image_tag }}-ARM64
137157
docker manifest push ${{ needs.generate-release-version.outputs.image_tag }}
138158
docker manifest inspect ${{ needs.generate-release-version.outputs.image_tag }}
139-
-
140-
name: Release
141-
env:
142-
GH_TOKEN: ${{ github.token }}
143-
run: |
144-
sha=$(git rev-parse --short HEAD)
145-
tag_value=${{ needs.generate-release-version.outputs.generated_version }}
146-
if [ -z "${{ needs.generate-release-version.outputs.tag_prefix }}" ]; then
147-
tag_value+="${{ github.ref_name }}-${sha}"
148-
else
149-
tag_value="${{ needs.generate-release-version.outputs.tag_prefix }}${{ needs.generate-release-version.outputs.generated_version }}"
150-
fi
151-
gh release create "${tag_value}" \
152-
--title "Release ${tag_value}" \
153-
--generate-notes \
154-
--repo ${{ github.repository }}
159+
160+
docker manifest create \
161+
${{ needs.generate-release-version.outputs.image_tag_latest }} \
162+
--amend ${{ needs.generate-release-version.outputs.image_tag }}-X64 \
163+
--amend ${{ needs.generate-release-version.outputs.image_tag }}-ARM64
164+
docker manifest push ${{ needs.generate-release-version.outputs.image_tag_latest }}
165+
docker manifest inspect ${{ needs.generate-release-version.outputs.image_tag_latest }}
166+

.github/workflows/release-pypi.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- main
9+
# paths-ignore:
10+
# - .github/**
11+
# - ./**/*.md
12+
pull_request:
13+
branches:
14+
- main
15+
16+
jobs:
17+
build:
18+
name: Build distribution 📦
19+
runs-on: ubuntu-latest
20+
outputs:
21+
package_name: ${{ steps.build_artifacts.outputs.package_name }}
22+
package_version: ${{ steps.build_artifacts.outputs.package_version }}
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
28+
fetch-tags: true
29+
fetch-depth: 0
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: "3.x"
34+
- name: Install pypa/build
35+
run: >-
36+
python3 -m pip install build hatchling hatch-vcs --user
37+
- name: Build a binary wheel and a source tarball
38+
id: build_artifacts
39+
run: |
40+
python3 -m build
41+
package_name=$(hatchling metadata name)
42+
package_version=$(hatchling version)
43+
echo "package_name=$package_name" >> $GITHUB_OUTPUT
44+
echo "package_version=$package_version" >> $GITHUB_OUTPUT
45+
- name: Store the distribution packages
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
51+
publish-to-pypi:
52+
name: >-
53+
Publish Python 🐍 distribution 📦 to PyPI
54+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
55+
needs:
56+
- build
57+
runs-on: ubuntu-latest
58+
environment:
59+
name: pypi
60+
url: https://pypi.org/p/${{ needs.build.outputs.package_name }}
61+
permissions:
62+
id-token: write # IMPORTANT: mandatory for trusted publishing
63+
64+
steps:
65+
- name: Download all the dists
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: python-package-distributions
69+
path: dist/
70+
- name: Publish distribution 📦 to PyPI
71+
uses: pypa/gh-action-pypi-publish@release/v1
72+
73+
github-release:
74+
name: >-
75+
Sign the Python 🐍 distribution 📦 with Sigstore
76+
and upload them to GitHub Release
77+
needs:
78+
- publish-to-pypi
79+
runs-on: ubuntu-latest
80+
81+
permissions:
82+
contents: write # IMPORTANT: mandatory for making GitHub Releases
83+
id-token: write # IMPORTANT: mandatory for sigstore
84+
85+
steps:
86+
- name: Download all the dists
87+
uses: actions/download-artifact@v4
88+
with:
89+
name: python-package-distributions
90+
path: dist/
91+
- name: Sign the dists with Sigstore
92+
uses: sigstore/gh-action-sigstore-python@v3.0.0
93+
with:
94+
inputs: >-
95+
./dist/*.tar.gz
96+
./dist/*.whl
97+
- name: Delete the stub of Release
98+
env:
99+
GITHUB_TOKEN: ${{ github.token }}
100+
run: >-
101+
gh release delete
102+
"$GITHUB_REF_NAME"
103+
--repo "$GITHUB_REPOSITORY"
104+
--cleanup-tag
105+
--yes
106+
- name: Create GitHub Release
107+
env:
108+
GITHUB_TOKEN: ${{ github.token }}
109+
run: |
110+
gh release create "$GITHUB_REF_NAME" \
111+
--title "Release $GITHUB_REF_NAME" \
112+
--generate-notes \
113+
--latest \
114+
--repo "$GITHUB_REPOSITORY"
115+
- name: Upload artifact signatures to GitHub Release
116+
env:
117+
GITHUB_TOKEN: ${{ github.token }}
118+
# Upload to GitHub Release using the `gh` CLI.
119+
# `dist/` contains the built packages, and the
120+
# sigstore-produced signatures and certificates.
121+
run: >-
122+
gh release upload
123+
"$GITHUB_REF_NAME" dist/**
124+
--repo "$GITHUB_REPOSITORY"
125+
126+
publish-to-testpypi:
127+
name: Publish Python 🐍 distribution 📦 to TestPyPI
128+
# we only publish to TestPyPI on merge to main
129+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
130+
needs:
131+
- build
132+
runs-on: ubuntu-latest
133+
134+
environment:
135+
name: testpypi
136+
url: https://test.pypi.org/p/${{ needs.build.outputs.package_name }}
137+
138+
permissions:
139+
id-token: write # IMPORTANT: mandatory for trusted publishing
140+
141+
steps:
142+
- name: Download all the dists
143+
uses: actions/download-artifact@v4
144+
with:
145+
name: python-package-distributions
146+
path: dist/
147+
- name: Publish distribution 📦 to TestPyPI
148+
uses: pypa/gh-action-pypi-publish@release/v1
149+
with:
150+
repository-url: https://test.pypi.org/legacy/
151+
skip-existing: true
152+
verbose: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var
3535
venv*/
3636
.venv*/
3737
wheelhouse
38+
src/docs2vecs/_version.py
3839

3940
# Installer logs
4041
pip-log.txt

0 commit comments

Comments
 (0)