From cb9ed5cdc7eff2e77ec1f2213573d5711e4e6b07 Mon Sep 17 00:00:00 2001 From: Hsiaoming Yang Date: Wed, 18 Dec 2024 22:35:54 +0900 Subject: [PATCH] chore: add pypi release action --- .github/workflows/pypi.yml | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..a186c75 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,69 @@ +name: Release theme to PyPI + +permissions: + contents: write + id-token: write + +on: + push: + tags: + - v2.* + +jobs: + build: + name: build dist files + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: install build + run: python -m pip install --upgrade build + + - name: build dist + run: python -m build + + - uses: actions/upload-artifact@v4 + with: + name: artifacts + path: dist/* + if-no-files-found: error + + publish: + environment: + name: pypi-release + url: https://pypi.org/p/livereload + + name: release to pypi + needs: build + runs-on: ubuntu-latest + + steps: + - uses: actions/download-artifact@v4 + with: + name: artifacts + path: dist + + - name: Push build artifacts to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + release: + name: write release note + runs-on: ubuntu-latest + needs: publish + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 18 + - run: npx changelogithub --no-group + continue-on-error: true + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}