diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..59205f0 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,33 @@ +name: Build and Publish to PyPI + +on: + workflow_call: + workflow_dispatch: + + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/swydd + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Python 3.9 + uses: actions/setup-python@v3 + with: + python-version: "3.9" + - name: Install pypa/build + run: >- + python -m pip install build --user + - name: Build a binary wheel and a source tarball + run: >- + python -m build --sdist --wheel --outdir dist/ . + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ee8181f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: 🚀 Release + +on: + push: + tags: + - 'v*.*' + +permissions: + contents: write + +jobs: + run-tests: + uses: ./.github/workflows/test.yml + + build-n-publish: + needs: run-tests + permissions: + id-token: write + uses: ./.github/workflows/pypi.yml + + create-release: + needs: build-n-publish + env: + GH_TOKEN: ${{ github.token }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: update latest tag + uses: richardsimko/update-tag@v1 + with: + tag_name: latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate New Release + run: gh release create ${{ github.ref }}