2024.10.10 #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DANCE | |
on: | |
push: | |
branches: | |
- main | |
path: | |
- 'disco/**' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Pull Repository | |
uses: actions/checkout@v4 | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install Dependencies | |
run: | | |
python -m pip install --no-cache-dir --upgrade pip | |
python -m pip install --no-cache-dir --upgrade setuptools | |
python -m pip install --no-cache-dir --upgrade wheel | |
python -m pip install --no-cache-dir --upgrade -r requirements.txt | |
python -m pip install --no-cache-dir --upgrade build | |
- name: Build Wheel and Tarball Packages | |
run: python3 -m build | |
- name: Store distribution packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
publish: | |
name: Publish | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/betterdisco-py | |
permissions: | |
id-token: write | |
steps: | |
- name: Download Distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
github-release: | |
name: Sign and Release | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # IMPORTANT: mandatory for making GitHub Releases | |
id-token: write # IMPORTANT: mandatory for sigstore | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Sign | |
uses: sigstore/gh-action-sigstore-python@v2.1.1 | |
with: | |
inputs: | | |
./dist/*.tar.gz | |
./dist/*.whl | |
- name: Create Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --notes "" | |
- name: Upload Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}' |