yggtools 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,181 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+
9
+ jobs:
10
+ details:
11
+ runs-on: ubuntu-latest
12
+ outputs:
13
+ package_name: ${{ steps.package_information.outputs.package_name }}
14
+ new_version: ${{ steps.release.outputs.new_version }}
15
+ suffix: ${{ steps.release.outputs.suffix }}
16
+ tag_name: ${{ steps.release.outputs.tag_name }}
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - name: Extract tag and Details
20
+ id: release
21
+ run: |
22
+ if [ "${{ github.ref_type }}" = "tag" ]; then
23
+ TAG_NAME=${GITHUB_REF#refs/tags/}
24
+ NEW_VERSION=$(echo $TAG_NAME | awk -F'-' '{print $1}')
25
+ SUFFIX=$(echo $TAG_NAME | awk -F'-' '{print $2}')
26
+ echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
27
+ echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
28
+ echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
29
+ echo "Version is $NEW_VERSION"
30
+ echo "Suffix is $SUFFIX"
31
+ echo "Tag name is $TAG_NAME"
32
+ else
33
+ echo "No tag found"
34
+ exit 1
35
+ fi
36
+
37
+ - name: Set up Python
38
+ uses: actions/setup-python@v4
39
+ with:
40
+ python-version: "3.12"
41
+ cache: "poetry"
42
+
43
+ - name: Get Name of Package
44
+ id: package_information
45
+ run: |
46
+ package_information=$(poetry version)
47
+ PACKAGE_NAME=$(echo $package_information | awk '{print $1}')
48
+ echo "Package name: $PACKAGE_NAME"
49
+ echo "package_name=$PACKAGE_NAME" >> "$GITHUB_OUTPUT"
50
+
51
+ check_pypi:
52
+ needs: details
53
+ runs-on: ubuntu-latest
54
+ steps:
55
+ - name: Fetch information from PyPI
56
+ run: |
57
+ PACKAGE_NAME=${{ needs.details.outputs.package_name}}
58
+ response=$(curl -s https://pypi.org/pypi/$PACKAGE_NAME/json || echo "{}")
59
+ latest_previous_version=$(echo $response | grep -oP '"releases":\{"\K[^"]+' | sort -rV | head -n 1)
60
+ if [ -z "$latest_previous_version" ]; then
61
+ echo "Package not found on PyPI."
62
+ latest_previous_version="0.0.0"
63
+ fi
64
+ echo "Latest version on PyPI: $latest_previous_version"
65
+ echo "latest_previous_version=$latest_previous_version" >> $GITHUB_ENV
66
+
67
+ - name: Compare versions and exit if not newer
68
+ run: |
69
+ NEW_VERSION=${{ needs.details.outputs.new_version }}
70
+ LATEST_VERSION=$latest_previous_version
71
+ if [ "$(printf '%s\n' "$LATEST_VERSION" "$NEW_VERSION" | sort -rV | head -n 1)" != "$NEW_VERSION" ] || [ "$NEW_VERSION" == "$LATEST_VERSION" ]; then
72
+ echo "The new version $NEW_VERSION is not greater than the latest version $LATEST_VERSION on PyPI."
73
+ exit 1
74
+ else
75
+ echo "The new version $NEW_VERSION is greater than the latest version $LATEST_VERSION on PyPI."
76
+ fi
77
+
78
+ setup_and_build:
79
+ needs: details
80
+ runs-on: ubuntu-latest
81
+ steps:
82
+ - uses: actions/checkout@v2
83
+
84
+ - name: Set up Python
85
+ uses: actions/setup-python@v4
86
+ with:
87
+ python-version: "3.12"
88
+ cache: "poetry"
89
+
90
+ - name: Set project version with Poetry
91
+ run: |
92
+ poetry version ${{ needs.details.outputs.new_version }}
93
+
94
+ - name: Bump version in pyproject.toml
95
+ run: |
96
+ git config user.name "GitHub Actions"
97
+ git config user.email "actions@github.com"
98
+ git checkout -b version-bump-${{ needs.details.outputs.new_version }}
99
+ git add pyproject.toml
100
+ git commit -m "Bump version to $VERSION"
101
+ git push origin version-bump-${{ needs.details.outputs.new_version }}
102
+
103
+ - name: Create Pull Request
104
+ uses: peter-evans/create-pull-request@v4
105
+ with:
106
+ branch: version-bump-${{ needs.details.outputs.new_version }}
107
+ title: "Bump version to ${{ needs.details.outputs.new_version }}"
108
+ body: "This PR bumps the version to ${{ needs.details.outputs.new_version }}."
109
+ labels: "version-bump"
110
+
111
+ - name: Install dependencies
112
+ run: poetry install --sync --no-interaction
113
+
114
+ - name: Build source and wheel distribution
115
+ run: |
116
+ poetry build
117
+
118
+ - name: Upload artifacts
119
+ uses: actions/upload-artifact@v3
120
+ with:
121
+ name: dist
122
+ path: dist/
123
+
124
+ pypi_publish:
125
+ name: Upload release to PyPI
126
+ needs: [setup_and_build, details]
127
+ runs-on: ubuntu-latest
128
+ environment:
129
+ name: release
130
+ permissions:
131
+ # In order to use Trusted Publisher
132
+ id-token: write
133
+ contents: read
134
+
135
+ steps:
136
+ - name: Download artifacts
137
+ uses: actions/download-artifact@v3
138
+ with:
139
+ name: dist
140
+ path: dist/
141
+
142
+ - name: Publish distribution to PyPI
143
+ uses: pypa/gh-action-pypi-publish@release/v1
144
+
145
+ # Alternatively, use this one
146
+ # - name: Mint token
147
+ # id: mint
148
+ # uses: tschm/token-mint-action@v1.0.3
149
+
150
+ # Requires poetry to be installed
151
+ # - name: Install Poetry
152
+ # uses: snok/install-poetry@v1
153
+
154
+ # - name: Publish the package with poetry
155
+ # run: |
156
+ # poetry publish -u __token__ -p '${{ steps.mint.outputs.api-token }}'
157
+
158
+ github_release:
159
+ name: Create GitHub Release
160
+ needs: [setup_and_build, details]
161
+ runs-on: ubuntu-latest
162
+ permissions:
163
+ contents: write
164
+ steps:
165
+ - name: Download artifacts
166
+ uses: actions/download-artifact@v3
167
+ with:
168
+ name: dist
169
+ path: ./dist/
170
+
171
+ - name: Create GitHub Release
172
+ id: create_release
173
+ uses: actions/create-release@v1
174
+ env:
175
+ GITHUB_TOKEN: ${{ github.token }}
176
+ with:
177
+ tag_name: ${{ needs.details.outputs.new_version }}
178
+ release_name: ${{ needs.details.outputs.tag_name }}
179
+ body: "Release of version ${{ needs.details.outputs.new_version }}"
180
+ draft: false
181
+ prerelease: ${{ needs.details.outputs.suffix != 'release' }} # Mark as prerelease for non-release
@@ -0,0 +1,69 @@
1
+ # This workflow will upload a Python Package to PyPI when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3
+
4
+ # This workflow uses actions that are not certified by GitHub.
5
+ # They are provided by a third-party and are governed by
6
+ # separate terms of service, privacy policy, and support
7
+ # documentation.
8
+
9
+ name: Upload Python Package
10
+
11
+ on:
12
+ push:
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ release-build:
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - uses: actions/setup-python@v5
25
+ with:
26
+ python-version: "3.x"
27
+
28
+ - name: Build release distributions
29
+ run: |
30
+ # NOTE: put your own distribution build steps here.
31
+ python -m pip install build
32
+ python -m build
33
+
34
+ - name: Upload distributions
35
+ uses: actions/upload-artifact@v4
36
+ with:
37
+ name: release-dists
38
+ path: dist/
39
+
40
+ pypi-publish:
41
+ runs-on: ubuntu-latest
42
+ needs:
43
+ - release-build
44
+ permissions:
45
+ # IMPORTANT: this permission is mandatory for trusted publishing
46
+ id-token: write
47
+
48
+ # Dedicated environments with protections for publishing are strongly recommended.
49
+ # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
50
+ environment:
51
+ name: pypi
52
+ # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
53
+ # url: https://pypi.org/p/YOURPROJECT
54
+ #
55
+ # ALTERNATIVE: if your GitHub Release name is the PyPI project version string
56
+ # ALTERNATIVE: exactly, uncomment the following line instead:
57
+ # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
58
+
59
+ steps:
60
+ - name: Retrieve release distributions
61
+ uses: actions/download-artifact@v4
62
+ with:
63
+ name: release-dists
64
+ path: dist/
65
+
66
+ - name: Publish release distributions to PyPI
67
+ uses: pypa/gh-action-pypi-publish@release/v1
68
+ with:
69
+ packages-dir: dist/
@@ -0,0 +1,10 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: yggtools
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.12
File without changes
@@ -0,0 +1,14 @@
1
+ [project]
2
+ name = "yggtools"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ dependencies = []
8
+
9
+ [project.scripts]
10
+ yggtools = "yggtools:main"
11
+
12
+ [build-system]
13
+ requires = ["hatchling"]
14
+ build-backend = "hatchling.build"
@@ -0,0 +1,2 @@
1
+ def main() -> None:
2
+ print("Hello from yggtools!!")