Skip to content

Commit 68a8602

Browse files
committed
Updated the GitHub workflows
1 parent 9738f18 commit 68a8602

File tree

13 files changed

+423
-259
lines changed

13 files changed

+423
-259
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Package and upload artifacts
2+
description: Package a Python project and upload the artifacts and release notes
3+
inputs:
4+
tag-name:
5+
description: 'The name of the tag for the GitHub release'
6+
required: true
7+
runs:
8+
using: 'composite'
9+
steps:
10+
- name: Parse changelog for release notes
11+
shell: bash
12+
run: |
13+
function extract_version_content() {
14+
changelog=$1
15+
target_version=$2
16+
17+
awk -v target="$target_version" '
18+
/^## / {
19+
if (found) exit;
20+
version=$2;
21+
if (version == target) found=1;
22+
next;
23+
}
24+
found { print; }
25+
' <<< "$changelog"
26+
}
27+
28+
changelog=$(cat "CHANGELOG.md")
29+
target_version=${{ inputs.tag-name }}
30+
echo "TAG_NAME=$target_version" >> $GITHUB_ENV
31+
content=$(extract_version_content "$changelog" "$target_version")
32+
33+
if [ -n "$content" ]; then
34+
echo "::notice::Found release notes for ${target_version}"
35+
echo "$content" >> release-notes.md
36+
else
37+
echo "::warning::Did not find release notes for ${target_version}"
38+
touch release-notes.md
39+
fi
40+
41+
- name: Upload release notes
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: release-notes
45+
path: release-notes.md
46+
47+
- name: Package and upload artifacts
48+
if: ${{ env.PACKAGE == 'true' }}
49+
uses: hynek/build-and-inspect-python-package@v2
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release
2+
description: Create a GitHub release and upload the package to PyPI
3+
inputs:
4+
pypi-api-token:
5+
description: 'PyPI API token'
6+
required: true
7+
tag-name:
8+
description: 'The name of the tag for the GitHub release'
9+
required: true
10+
github-token:
11+
description: 'GitHub token'
12+
required: true
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Download packages built by build-and-inspect-python-package
18+
uses: actions/download-artifact@v4
19+
with:
20+
name: Packages
21+
path: dist
22+
23+
- name: Download release notes
24+
uses: actions/download-artifact@v4
25+
with:
26+
name: release-notes
27+
28+
- name: Create a GitHub release
29+
uses: softprops/action-gh-release@v1
30+
with:
31+
files: dist/*
32+
tag_name: "${{ inputs.tag-name }}"
33+
body_path: release-notes.md
34+
token: ${{ inputs.github-token }}
35+
36+
- name: Upload package to PyPI
37+
uses: pypa/gh-action-pypi-publish@release/v1
38+
with:
39+
password: ${{ inputs.pypi-api-token }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: checkout-and-setup-python
2+
description: 'Checkout the repository and setup Python'
3+
inputs:
4+
python-version:
5+
description: 'Python version to use'
6+
required: false
7+
default: '3.11'
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- uses: actions/setup-python@v4
12+
name: Setup Python
13+
with:
14+
python-version: ${{ inputs.python-version }}
15+
cache: 'pip' # caching pip dependencies
16+
17+
- name: Git check
18+
run: |
19+
git config --global user.email "[email protected]"
20+
git config --global user.name "Testing Git"
21+
git --version
22+
git config --list
23+
shell: bash

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Keep GitHub Actions up to date with GitHub's Dependabot...
2+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
3+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
4+
version: 2
5+
updates:
6+
- package-ecosystem: github-actions
7+
directory: /
8+
groups:
9+
github-actions:
10+
patterns:
11+
- "*" # Group all Actions updates into a single larger pull request
12+
schedule:
13+
interval: weekly

.github/workflows/bumpversion.yaml

Lines changed: 0 additions & 97 deletions
This file was deleted.

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/workflows/docs-final.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy final documentation
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
token: ${{ secrets.PAT }}
18+
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.10"
23+
24+
- name: Install dependencies
25+
run: |
26+
git pull --all
27+
python -m pip install ".[docs]"
28+
29+
- name: Build and deploy documentation
30+
run: |
31+
mkdocs gh-deploy --strict -v

.github/workflows/docs-preview.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy PR previews
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
- closed
10+
11+
concurrency: preview-${{ github.ref }}
12+
13+
jobs:
14+
deploy-preview:
15+
runs-on: ubuntu-20.04
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python 3.10
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.10"
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install ".[docs]"
30+
31+
- name: Build documentation
32+
run: |
33+
mkdocs build --strict -v
34+
35+
- name: Deploy preview
36+
uses: rossjrw/pr-preview-action@v1
37+
with:
38+
source-dir: ./site/

.github/workflows/publish-docs.yaml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)