Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
prochy-exe committed Apr 20, 2024
0 parents commit 2d35631
Show file tree
Hide file tree
Showing 12 changed files with 1,599 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
34 changes: 34 additions & 0 deletions .github/workflows/cache_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Cache build dependencies
on:
workflow_dispatch:

permissions:
contents: read
actions: write # require to delete cache

jobs:

conv-cache:
name: Cache build dependencies
runs-on: ubuntu-latest
env:
cache-key: build_cache
steps:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: python -m pip install --upgrade pip
- name: Delete Previous Cache
continue-on-error: true
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete "${{ env.cache-key }}" --confirm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save Cache
uses: actions/cache/save@v3
with:
path: /opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages
key: ${{ env.cache-key }}
80 changes: 80 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Publish on Github and PyPi
on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:

build-package:
name: Build Python package
runs-on: ubuntu-latest
env:
cache-key: build_cache
steps:
- name: Checkout current code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Restore Cache
id: python-restore
uses: actions/cache/restore@v3
with:
path: /opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages
key: ${{ env.cache-key }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: python-files
path: dist/
retention-days: 1

publish-github:
name: Create a release on Github
runs-on: ubuntu-latest
needs: build-package
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@master
with:
name: python-files
path: dist/
- name: Publish on Github
uses: ncipollo/release-action@v1
with:
makeLatest: true
artifacts: dist/*
artifactErrorsFailBuild: true

publish-pypi:
name: Publish on PyPi
runs-on: ubuntu-latest
needs: publish-github
permissions:
id-token: write
actions: write
steps:
- name: Download artifacts
uses: actions/download-artifact@master
with:
name: python-files
path: dist/
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT }}
repository: prochy-exe/subsplease-scraper
event-type: new_release
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mal_helper.egg-info
__pycache__
config
cache
/.vscode
/build

0 comments on commit 2d35631

Please sign in to comment.