-
Notifications
You must be signed in to change notification settings - Fork 3
46 lines (37 loc) · 1.87 KB
/
publish.yml
File metadata and controls
46 lines (37 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Workflow name: Upload Python Package to PyPI when a Release is Created
name: Upload Python Package to PyPI when a Release is Created
# Trigger the workflow on release creation
on:
release:
types: [created] # Specifies that this workflow runs when a release is created
# Allows manual execution from the Actions tab
workflow_dispatch:
jobs:
pypi-publish: # Job name for publishing the release to PyPI
name: Publish release to PyPI # Descriptive name for the job
runs-on: ubuntu-latest # Specifies the environment where the job will run (Ubuntu latest version)
environment:
name: release # Name of the environment (used for deployment)
url: https://pypi.org/p/SAES # URL of the PyPI package
permissions: # Define permissions for the workflow
id-token: write # Allows writing the ID token for authenticating with PyPI
steps: # Steps to execute the job
# Step 1: Check out the repository
- uses: actions/checkout@v4 # Uses the checkout action to pull the repository code
# Step 2: Set up Python
- name: Set up Python
uses: actions/setup-python@v4 # Uses the setup-python action to configure Python
with:
python-version: "3.10" # Specifies the Python version to use (3.10 in this case)
# Step 3: Install dependencies
- name: Install dependencies
run: | # Runs a shell script
python -m pip install --upgrade pip # Upgrades pip to the latest version
pip install build # Installs the build library for creating distributions
# Step 4: Build the package
- name: Build package
run: |
python -m build # Builds the package for distribution
# Step 5: Publish the package to PyPI
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 # Uses the PyPI publish GitHub Action