From 3d13a447ece9721703b6bfe216dfaa35c86215ed Mon Sep 17 00:00:00 2001 From: andy Date: Sun, 5 May 2024 00:51:42 +0200 Subject: [PATCH] Add publish to PyPI workflow --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..48ea90b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: Publish release + +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/coh2-live-stats + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - name: set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: create virtual environment + run: | + python -m venv --without-pip .venv + python -m venv --upgrade-deps --upgrade .venv + - name: activate virtual environment + run: python -c "from scripts.github_actions.activate import run; run()" + - name: install dependencies + run: python -m pip install build twine + - name: build package + run: python -m build + - name: check package + run: python -m twine check dist/* + - name: publish package + uses: pypa/gh-action-pypi-publish@release/v1