Skip to content

Commit 7a26bc5

Browse files
Merge pull request #24 from abhishekmj303/dev
Publish package to PyPI
2 parents 0f28009 + 2705c70 commit 7a26bc5

File tree

6 files changed

+123
-61
lines changed

6 files changed

+123
-61
lines changed

.github/workflows/build.yaml

+101-40
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,50 @@
11
name: Build and Release
22

3-
on:
4-
push:
5-
tags:
6-
- "v*"
3+
on: push
74

85
jobs:
96
build:
7+
name: >-
8+
Build and Package 📦
9+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/release' }}
1010
strategy:
1111
matrix:
12-
os: [macos-latest, ubuntu-latest, windows-latest]
12+
os: [windows-latest, ubuntu-latest, macos-latest]
1313

1414
runs-on: ${{ matrix.os }}
1515

1616
steps:
1717
- name: Check-out repository
1818
uses: actions/checkout@v4
1919

20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v3
22+
with:
23+
enable-cache: true
24+
2025
- name: Setup Python
2126
uses: actions/setup-python@v5
2227
with:
23-
python-version: "3.11"
28+
python-version-file: ".python-version"
2429
cache: "pip"
2530
cache-dependency-path: |
2631
**/requirements*.txt
2732
28-
- name: Install your Dependencies
33+
- name: Install the project
34+
run: pip install .
35+
36+
- name: Build a binary wheel and a source tarball
37+
if: matrix.os == 'ubuntu-latest'
2938
run: |
30-
pip install -r requirements.txt
39+
uv build
40+
41+
- name: Store the distribution packages
42+
if: matrix.os == 'ubuntu-latest'
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: python-package-distributions
46+
path: dist/
47+
overwrite: true
3148

3249
- name: Build Executable with Nuitka
3350
uses: Nuitka/Nuitka-Action@main
@@ -60,40 +77,84 @@ jobs:
6077
build/*.bin
6178
build/*.app/**/*
6279
overwrite: true
63-
80+
81+
publish-to-pypi:
82+
name: >-
83+
Publish Python 🐍 distribution 📦 to PyPI
84+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
85+
needs:
86+
- build
87+
runs-on: ubuntu-latest
88+
environment:
89+
name: pypi
90+
url: https://pypi.org/p/ytm2spt
91+
permissions:
92+
id-token: write # IMPORTANT: mandatory for trusted publishing
93+
94+
steps:
95+
- name: Download all the dists
96+
uses: actions/download-artifact@v4
97+
with:
98+
name: python-package-distributions
99+
path: dist/
100+
- name: Publish distribution 📦 to PyPI
101+
uses: pypa/gh-action-pypi-publish@release/v1
102+
64103
release:
65-
if: startsWith(github.ref, 'refs/tags/')
66-
needs: build
104+
name: >-
105+
Create a GitHub Release 🚀
106+
needs:
107+
- build
108+
- publish-to-pypi
67109
runs-on: ubuntu-latest
110+
111+
permissions:
112+
contents: write # IMPORTANT: mandatory for making GitHub Releases
113+
id-token: write # IMPORTANT: mandatory for sigstore
114+
68115
steps:
69-
- name: Download All Artifacts
70-
uses: actions/download-artifact@v4
71-
- run: ls -R
116+
- name: Download all the dists
117+
uses: actions/download-artifact@v4
118+
with:
119+
name: python-package-distributions
120+
path: dist/
121+
- name: Sign the dists with Sigstore
122+
uses: sigstore/[email protected]
123+
with:
124+
inputs: >-
125+
./dist/*.tar.gz
126+
./dist/*.whl
127+
128+
- name: Download All Artifacts
129+
uses: actions/download-artifact@v4
130+
- run: ls -R
72131

73-
- name: Add Executable Permissions
74-
run: |
75-
chmod +x *build/*.bin *build/*.exe *build/*.app/Contents/MacOS/*
76-
77-
- name: Zip Windows Executable
78-
run: |
79-
cd *windows-build
80-
zip -9 ytm2spt-${{ github.ref_name }}-windows.zip *-installer.exe
81-
82-
- name: Tar Linux Executable
83-
run: |
84-
cd *linux-build
85-
tar -cavf ytm2spt-${{ github.ref_name }}-linux.tar.gz *.bin
86-
87-
- name: Zip MacOS Executable
88-
run: |
89-
cd *macos-build
90-
zip -r -9 ytm2spt-${{ github.ref_name }}-macos.zip *.app
132+
- name: Add Executable Permissions
133+
run: |
134+
chmod +x *build/*.bin *build/*.exe *build/*.app/Contents/MacOS/*
135+
136+
- name: Zip Windows Executable
137+
run: |
138+
cd *windows-build
139+
zip -9 ytm2spt-windows.zip *-installer.exe
140+
141+
- name: Zip Linux Executable
142+
run: |
143+
cd *linux-build
144+
tar -cavf ytm2spt-linux.tar.gz *.bin
145+
146+
- name: Zip MacOS Executable
147+
run: |
148+
cd *macos-build
149+
zip -r -9 ytm2spt-macos.zip *.app
91150
92-
- name: Release
93-
uses: softprops/action-gh-release@v2
94-
with:
95-
draft: true
96-
files: |
97-
*build/ytm2spt-${{ github.ref_name }}-windows.zip
98-
*build/ytm2spt-${{ github.ref_name }}-linux.tar.gz
99-
*build/ytm2spt-${{ github.ref_name }}-macos.zip
151+
- name: GitHub Release
152+
uses: softprops/action-gh-release@v2
153+
with:
154+
draft: true
155+
generate_release_notes: true
156+
files: |
157+
*build/ytm2spt-windows.zip
158+
*build/ytm2spt-linux.tar.gz
159+
*build/ytm2spt-macos.zip
160+
dist/*

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ ytmusicapi-oauth.json
1818
*.exe
1919
venv
2020
dist
21+
build

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "ytm2spt"
3-
version = "1.0.2"
3+
version = "1.1.0"
44
authors = [
55
{ name="Abhishek M J", email="[email protected]" },
66
]

src/ytm2spt/__init__.py

-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
# Nuitka Configuration
2-
# nuitka-project: --enable-plugins=pyside6
3-
# nuitka-project: --user-package-configuration-file=ytmusicapi.nuitka-package.config.yaml
4-
#
5-
# Compilation mode, standalone everywhere, except on macOS there app bundle
6-
# nuitka-project-if: {OS} in ("Linux", "FreeBSD"):
7-
# nuitka-project: --onefile
8-
# nuitka-project-if: {OS} == "Windows":
9-
# nuitka-project: --standalone
10-
# nuitka-project-if: {OS} == "Darwin":
11-
# nuitka-project: --standalone
12-
# nuitka-project: --macos-create-app-bundle
13-
#
14-
# Debugging options, controlled via environment variable at compile time.
15-
# nuitka-project-if: os.getenv("DEBUG_COMPILATION", "yes") == "yes":
16-
# nuitka-project: --enable-console
17-
# nuitka-project-else:
18-
# nuitka-project: --disable-console
19-
201
import sys
212

223

uv.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ytm2spt.py

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# Nuitka Configuration
2+
# nuitka-project: --enable-plugins=pyside6
3+
# nuitka-project: --user-package-configuration-file=ytmusicapi.nuitka-package.config.yaml
4+
#
5+
# Compilation mode, standalone everywhere, except on macOS there app bundle
6+
# nuitka-project-if: {OS} in ("Linux", "FreeBSD"):
7+
# nuitka-project: --onefile
8+
# nuitka-project-if: {OS} == "Windows":
9+
# nuitka-project: --standalone
10+
# nuitka-project-if: {OS} == "Darwin":
11+
# nuitka-project: --standalone
12+
# nuitka-project: --macos-create-app-bundle
13+
#
14+
# Debugging options, controlled via environment variable at compile time.
15+
# nuitka-project-if: os.getenv("DEBUG_COMPILATION", "yes") == "yes":
16+
# nuitka-project: --enable-console
17+
# nuitka-project-else:
18+
# nuitka-project: --disable-console
19+
120
from src.ytm2spt import main
221

322
main()

0 commit comments

Comments
 (0)