Skip to content

fix(ci) join workflow #1

fix(ci) join workflow

fix(ci) join workflow #1

Workflow file for this run

name: "Publish to Package"
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0,
workflow_dispatch:
jobs:
build:
name: "Build distribution"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: "Install pypa/build"
run: python3 -m pip install build --user
- name: "Build a binary wheel and a source tarball"
run: python3 -m build
- name: "Store the distribution packages"
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: "Publish distribution to PyPI "
if: ${{ ! contains( github.ref , '-dev') }}
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/PFB-Toolkit/
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: "Download all the dists"
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: "Publish to PyPI"
uses: pypa/gh-action-pypi-publish@release/v1
publish-to-testpypi:
name: "Publish distribution to testPyPI"
if: contains( github.ref , '-dev')
needs:
- build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/project/PFB-Toolkit/
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: "Download all the dists"
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:
repository-url: https://test.pypi.org/legacy/
user: __token__
password: ${{ secrets.TESTPYPI_API_TOKEN }}
github-release:
name: "Release"
needs:
- build
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Download all the dists"
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: "Create Release"
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: RELEASE.md
draft: false
prerelease: false
- name: "Upload artifact"
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'