Build by @thatgaypigeon #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
run-name: Build by @${{ github.actor }} | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- somos/** | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version type to bump (major, minor, patch)' | |
required: false | |
default: 'patch' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install pip | |
run: python -m pip install --upgrade pip | |
- name: Install dependencies | |
run: pip install coverage Bandit pre-commit bump-my-version | |
# run: pip install -r requirements.txt | |
# Lint | |
- name: Lint | |
run: pre-commit run --all-files | |
# Code coverage | |
- name: Run tests with coverage | |
run: coverage run -m unittest discover tests | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
# Security checks | |
- name: Security checks | |
run: bandit -r . | |
# Pre-build commit | |
- name: Pre-build commit | |
run: | | |
git add | |
git commit | |
# Deploy build | |
- name: Bump version | |
id: bump | |
run: bump-my-version bump ${{ github.event.inputs.version || 'patch' }} | |
- name: Create GitHub release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.bump.outputs.new_version }} | |
release_name: Release ${{ steps.bump.outputs.new_version }} | |
draft: false | |
prerelease: false | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |