Skip to content

Commit

Permalink
Merge pull request #69 from callowayproject/cookiecutter-update
Browse files Browse the repository at this point in the history
Cookiecutter update
  • Loading branch information
coordt authored May 5, 2024
2 parents 45c02d2 + e7db476 commit dc537f0
Show file tree
Hide file tree
Showing 126 changed files with 1,439 additions and 3,808 deletions.
49 changes: 49 additions & 0 deletions .github/actions/package-and-upload-artifacts/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Package and upload artifacts
description: Package a Python project and upload the artifacts and release notes
inputs:
tag-name:
description: 'The name of the tag for the GitHub release'
required: true
runs:
using: 'composite'
steps:
- name: Parse changelog for release notes
shell: bash
run: |
function extract_version_content() {
changelog=$1
target_version=$2
awk -v target="$target_version" '
/^## / {
if (found) exit;
version=$2;
if (version == target) found=1;
next;
}
found { print; }
' <<< "$changelog"
}
changelog=$(cat "CHANGELOG.md")
target_version=${{ inputs.tag-name }}
echo "TAG_NAME=$target_version" >> $GITHUB_ENV
content=$(extract_version_content "$changelog" "$target_version")
if [ -n "$content" ]; then
echo "::notice::Found release notes for ${target_version}"
echo "$content" >> release-notes.md
else
echo "::warning::Did not find release notes for ${target_version}"
touch release-notes.md
fi
- name: Upload release notes
uses: actions/upload-artifact@v4
with:
name: release-notes
path: release-notes.md

- name: Package and upload artifacts
if: ${{ env.PACKAGE == 'true' }}
uses: hynek/build-and-inspect-python-package@v2
39 changes: 39 additions & 0 deletions .github/actions/release/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release
description: Create a GitHub release and upload the package to PyPI
inputs:
pypi-api-token:
description: 'PyPI API token'
required: true
tag-name:
description: 'The name of the tag for the GitHub release'
required: true
github-token:
description: 'GitHub token'
required: true

runs:
using: "composite"
steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Download release notes
uses: actions/download-artifact@v4
with:
name: release-notes

- name: Create a GitHub release
uses: softprops/action-gh-release@v1
with:
files: dist/*
tag_name: "${{ inputs.tag-name }}"
body_path: release-notes.md
token: ${{ inputs.github-token }}

- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ inputs.pypi-api-token }}
23 changes: 23 additions & 0 deletions .github/actions/setup-python-and-git/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: checkout-and-setup-python
description: 'Checkout the repository and setup Python'
inputs:
python-version:
description: 'Python version to use'
required: false
default: '3.11'
runs:
using: 'composite'
steps:
- uses: actions/setup-python@v4
name: Setup Python
with:
python-version: ${{ inputs.python-version }}
cache: 'pip' # caching pip dependencies

- name: Git check
run: |
git config --global user.email "[email protected]"
git config --global user.name "Testing Git"
git --version
git config --list
shell: bash
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Keep GitHub Actions up to date with GitHub's Dependabot...
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
version: 2
updates:
- package-ecosystem: github-actions
directory: /
groups:
github-actions:
patterns:
- "*" # Group all Actions updates into a single larger pull request
schedule:
interval: weekly
97 changes: 0 additions & 97 deletions .github/workflows/bumpversion.yaml

This file was deleted.

72 changes: 0 additions & 72 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/docs-final.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy final documentation

on:
push:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
git pull --all
python -m pip install ".[docs]"
- name: Build and deploy documentation
run: |
mkdocs gh-deploy --strict -v
38 changes: 38 additions & 0 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy PR previews

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

concurrency: preview-${{ github.ref }}

jobs:
deploy-preview:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install ".[docs]"
- name: Build documentation
run: |
mkdocs build --strict -v
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./site/
25 changes: 0 additions & 25 deletions .github/workflows/publish-docs.yaml

This file was deleted.

Loading

0 comments on commit dc537f0

Please sign in to comment.