Skip to content

Release

Release #6

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*' # Triggers on version tags like v1.0.0
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Run tests
run: |
pytest tests/ -v
release:
needs: test
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for tags
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Extract version from tag
id: tag_version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Update version in setup.py
run: |
sed -i "s/version=\".*\"/version=\"${{ steps.tag_version.outputs.version }}\"/" setup.py
cat setup.py | grep version
- name: Build package
run: |
python -m build
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.whl
dist/*.tar.gz
name: Release ${{ steps.tag_version.outputs.version }}
body: |
## Website-Diff ${{ steps.tag_version.outputs.version }}
### Installation
```bash
pip install website-diff==${{ steps.tag_version.outputs.version }}
```
### Changes
See [CHANGELOG](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.
### Downloads
- Source distribution: `website-diff-${{ steps.tag_version.outputs.version }}.tar.gz`
- Wheel: `website_diff-${{ steps.tag_version.outputs.version }}-py3-none-any.whl`
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}