diff --git a/.github/collect_plugin.py b/.github/collect_plugin.py new file mode 100644 index 00000000..3e9122a6 --- /dev/null +++ b/.github/collect_plugin.py @@ -0,0 +1,68 @@ +import json +import os +from pathlib import Path +from urllib.request import urlopen, Request + +inp_project = os.environ.get('PROJECT').strip() +inp_author = os.environ.get('AUTHOR').strip() +file_name = Path(f'_repo/{inp_project}.md') +crowdin_projet_id = 452300 + +print(f'Collecting {inp_project} with {inp_author}...') + +def get_data(url, key=None, default=0, auth=None): + """Fetches data from remote endpoint""" + httprequest = Request(url, headers={"Accept": "application/json"}) + + if auth: + httprequest.add_header("Authorization", f"Bearer {auth}") + + with urlopen(httprequest) as response: + data = response.read().decode() + data = json.loads(data) + + if key: + data = data.get(key, default) + + return data + +pypi_data = get_data(f'https://pypi.org/pypi/{inp_project}/json') + +name = pypi_data['info']['name'] +tagline = pypi_data['info']['summary'] +author = inp_author or pypi_data['info']['author_email'] +license = pypi_data['info']['license'] +try: + version = pypi_data['info']['version'] + stable = int(version.split('.')[0])>1 +except: + stable = False +bugtracker = pypi_data['info']['bugtrack_url'] or pypi_data['info']['project_urls'].get('Bug Tracker') or '' +homepage = pypi_data['info']['home_page'] or pypi_data['info']['project_urls'].get('Homepage') +keywords = pypi_data['info']['keywords'] +readme = pypi_data['info']['description'] + +# Write data +file_name.write_text( +f"""--- +name: {name} +author: {author} +license: {license} +open_source: true +stable: {stable} +maintained: true +pypi: true +package_name: {name} +github: {homepage} +gitlab: +source: +issue_tracker:{bugtracker} +website: +categories: +tags: {keywords} +--- +{tagline} + +{readme} +""" +) diff --git a/.github/workflows/collect_plugin.yml b/.github/workflows/collect_plugin.yml new file mode 100644 index 00000000..5fdc7390 --- /dev/null +++ b/.github/workflows/collect_plugin.yml @@ -0,0 +1,42 @@ +name: Collect plugin by PyPI listing + +on: + workflow_dispatch: + inputs: + project: + description: The name of the project on PyPi + required: true + author: + description: Enter the name of the author if you know it + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v2 + - name: Get Plugin file + run: python .github/collect_plugin.py + env: + PROJECT: ${{ github.event.inputs.project }} + AUTHOR: ${{ github.event.inputs.author }} + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "[REPO] Add plugin ${{ github.event.inputs.project }}" + branch: "plugin/${{ github.event.inputs.project }}" + title: "[REPO] Add plugin ${{ github.event.inputs.project }}" + body: | + Automated PR to add the plugin ${{ github.event.inputs.project }}. + You need to check this manually! + labels: | + plugin + assignees: | + matmair + ${{ github.event.inputs.author }} + reviewers: | + matmair diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 45657133..b3cc0b71 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,9 +1,7 @@ name: Build pages and publish on: - push: - branches: - - main + push jobs: build: @@ -23,7 +21,10 @@ jobs: uses: limjh16/jekyll-action-ts@v2 with: enable_cache: true + - run: bundle exec htmlproofer ./_site --enforce-https=false + name: Check links - name: Deploy + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main'}} uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Gemfile b/Gemfile index 16b2a3e2..caa6dac9 100644 --- a/Gemfile +++ b/Gemfile @@ -10,3 +10,4 @@ group :jekyll_plugins do gem 'jekyll_custom_permalink' end gem "webrick", "~> 1.7" +gem 'html-proofer' diff --git a/Gemfile.lock b/Gemfile.lock index 50e896b5..e748d7c3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,13 +13,23 @@ GEM em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) + ethon (0.16.0) + ffi (>= 1.15.0) eventmachine (1.2.7) ffi (1.15.5) forwardable-extended (2.6.0) - google-protobuf (3.21.12-x86_64-linux) html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) + html-proofer (4.4.3) + addressable (~> 2.3) + mercenary (~> 0.3) + nokogiri (~> 1.13) + parallel (~> 1.10) + rainbow (~> 3.0) + typhoeus (~> 1.3) + yell (~> 2.0) + zeitwerk (~> 2.5) http_parser.rb (0.8.0) i18n (1.12.0) concurrent-ruby (~> 1.0) @@ -64,12 +74,16 @@ GEM rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) minitest (5.17.0) + nokogiri (1.14.0-aarch64-linux) + racc (~> 1.4) nokogiri (1.14.0-x86_64-linux) racc (~> 1.4) + parallel (1.22.1) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (5.0.1) racc (1.6.2) + rainbow (3.1.1) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) @@ -80,15 +94,20 @@ GEM ffi (~> 1.9) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) + typhoeus (1.4.0) + ethon (>= 0.9.0) tzinfo (2.0.5) concurrent-ruby (~> 1.0) unicode-display_width (2.4.2) webrick (1.7.0) + yell (2.2.2) + zeitwerk (2.6.6) PLATFORMS x86_64-linux DEPENDENCIES + html-proofer jekyll jekyll-feed jekyll-mentions @@ -99,4 +118,4 @@ DEPENDENCIES webrick (~> 1.7) BUNDLED WITH - 2.3.26 + 2.4.6 diff --git a/_data/functions/extras.yml b/_data/functions/extras.yml index d18d7c8c..dd310b7e 100644 --- a/_data/functions/extras.yml +++ b/_data/functions/extras.yml @@ -7,4 +7,4 @@ functions: link: https://docs.inventree.org/en/latest/report/report/ - title: Extend and Customize text: InvenTree is designed to be highly extensible. If the core InvenTree functionality does not meet your particular need, InvenTree provides a RESTful API, a native Python library, and a powerful plugin system. - link: https://docs.inventree.org/en/latest/extend/api/ + link: https://docs.inventree.org/en/latest/api/api/ diff --git a/_data/general/stats.yml b/_data/general/stats.yml index f00f2d1d..cd1f7a3e 100644 --- a/_data/general/stats.yml +++ b/_data/general/stats.yml @@ -1,12 +1,12 @@ stats: - name: Docker pulls - number: 2228985 + number: 2233812 icon: fa-brands fa-docker - name: GitHub Stars - number: 2393 + number: 2418 icon: fa-solid fa-star - name: Forks - number: 378 + number: 381 icon: fa-solid fa-code-branch - name: Contributors number: 52 diff --git a/_includes/base/footer.html b/_includes/base/footer.html index 41a81eec..b1839f62 100644 --- a/_includes/base/footer.html +++ b/_includes/base/footer.html @@ -1,10 +1,10 @@