Skip to content

Commit

Permalink
feat: add scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sparanoid committed Nov 5, 2023
1 parent 93a942e commit 880ad9a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
20 changes: 4 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish Python distribution to PyPI and TestPyPI
name: Publish

on: push

Expand All @@ -14,15 +14,6 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.x"
# - name: "Install dependencies"
# run: "scripts/install"
# - name: "Build package & docs"
# run: "scripts/build"
# - name: "Publish to PyPI & deploy docs"
# run: "scripts/publish"
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

- name: Install pypa/build
run: >-
Expand All @@ -39,7 +30,7 @@ jobs:
path: dist/

publish-to-testpypi:
name: Publish Python distribution to TestPyPI
name: Publish to TestPyPI
needs:
- build
runs-on: ubuntu-latest
Expand All @@ -63,8 +54,7 @@ jobs:
repository-url: https://test.pypi.org/legacy/

publish-to-pypi:
name: >-
Publish Python distribution to PyPI
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
Expand All @@ -87,9 +77,7 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python distribution with Sigstore
and upload them to GitHub Release
name: Sigstore and GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# blivedm
# laplace-blivedm

Fork of [blivedm](https://github.com/xfgryujk/blivedm) with additional events support

Expand Down
12 changes: 12 additions & 0 deletions scripts/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh -e

if [ -d 'venv' ] ; then
PREFIX="venv/bin/"
else
PREFIX=""
fi

set -x

${PREFIX}python -m build
${PREFIX}twine check dist/*
19 changes: 19 additions & 0 deletions scripts/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh -e

# Use the Python executable provided from the `-p` option, or a default.
[ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3"

REQUIREMENTS="requirements.txt"
VENV="venv"

set -x

if [ -z "$GITHUB_ACTIONS" ]; then
"$PYTHON" -m venv "$VENV"
PIP="$VENV/bin/pip"
else
PIP="pip"
fi

"$PIP" install -U pip
"$PIP" install -r "$REQUIREMENTS"

0 comments on commit 880ad9a

Please sign in to comment.