Skip to content

Commit

Permalink
build: add workflow to upload package to pypi
Browse files Browse the repository at this point in the history
(cherry picked from commit 2e1e97b)
(cherry picked from commit 3b8349e58fbccf62b722016766bf5b285539a227)
  • Loading branch information
Ian2012 committed Nov 26, 2024
1 parent 17a742b commit 45cb796
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Publish Python 🐍 distributions 📦 to PyPI

on:
release:
types: [published]

permissions:
contents: read

jobs:
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
fetch-depth: 0

- name: Python Semantic Release
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.12

- name: Install dependencies
run: |
Expand All @@ -28,3 +28,12 @@ jobs:
run: make release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build package
run: |
python -m build --sdist --wheel --outdir dist/ .
- name: Publish package
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
release: ## release a new version
@echo "Releasing a new version."
@echo "This is a remote release, it will push to the remote repository."
semantic-release -vv version --changelog --push --tag --commit
semantic-release --strict version --changelog --push --tag --commit

local-release:
@echo "Releasing a new version."
@echo "This is a local release, it will not push to the remote repository."
@echo "You can push the changes and release manually."
semantic-release -vv version --changelog --commit --no-push
semantic-release version --changelog --commit --no-push

selfcheck: ## check that the Makefile is well-formed
@echo "The Makefile is well-formed."
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "drydock"
name = "tutor-contrib-drydock"
dynamic = ["version"]
description = "A Tutor plugin to manage our opinionated Open edX operations"
readme = "README.md"
Expand Down

0 comments on commit 45cb796

Please sign in to comment.