Skip to content

Commit

Permalink
feat: Setup automatic semantic version releases with PyPi publishing
Browse files Browse the repository at this point in the history
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
  • Loading branch information
swvanbuuren committed Aug 21, 2024
1 parent 8caeb29 commit 9a29ee1
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml → .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: ci
name: docs

on:
push:
branches:
- master

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Release workflow for push commits to the master branch

# This workflow uses python semantic releases, which relies on certain commit tags to
# determine if a new release/version should be created.
# Checkout https://github.com/python-semantic-release/python-semantic-release form more
# info on how to use it.
# Also checkout https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#type to
# which types of commit messages are accepted

name: Release

on:
push:
branches:
- master

jobs:
release:
name: Semantic Release
runs-on: ubuntu-latest
concurrency: push
if: github.repository == 'swvanbuuren/simple-cdd-yaml'
environment:
name: pypi
url: https://pypi.org/project/simple-cdd-yaml/
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}

- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
if: steps.release.outputs.released == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
if: steps.release.outputs.released == 'true'
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
if: steps.release.outputs.released == 'true'
run: python -m build

- name: Publish package distributions to PyPI
id: pypi-publish
if: steps.release.outputs.released == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true

- name: Publish package distributions to GitHub Releases
id: github-release
if: steps.release.outputs.released == 'true'
uses: python-semantic-release/upload-to-gh-release@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ information.

## Installation

Simple-CDD-YAML can be installed using `pip`:
```
pip install git+https://github.com/swvanbuuren/simple-cdd-yaml.git
Simple-CDD-YAML can be directly installed from [PyPi](https://pypi.org) using
`pip`:

```bash
pip install simple-cdd-yaml
```

## Usage
Expand Down

0 comments on commit 9a29ee1

Please sign in to comment.