Skip to content

Commit

Permalink
Add GitHub Actions + Dependabot
Browse files Browse the repository at this point in the history
  • Loading branch information
pschmitt committed Nov 10, 2023
1 parent a95f218 commit 4dc0cab
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
27 changes: 27 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Python Lint

on: [push, pull_request]

jobs:
lint:

runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: flake8
uses: py-actions/flake8@v2

- name: Black
run: |
python -m pip install --upgrade pip
pip install black
black --check --diff .
34 changes: 34 additions & 0 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Python Package

on:
release:
types: [created]
push:
tags:
- '*'

jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ldifj
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: python build
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
45 changes: 45 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: GitHub Release

on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate Changelog
id: changelog
run: |-
current_tag=$(git describe --tags --abbrev=0)
previous_tag=$(git describe --tags --abbrev=0 "${current_tag}^")
if [[ -z "$previous_tag" ]]
then
previous_tag="$(git log --reverse --format="format:%H" | head -1)"
fi
changelog=$(git log "${previous_tag}..${current_tag}" \
--oneline --no-merges --pretty=format:"%h %s")
echo "changelog:"
echo "$changelog"
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "changelog<<$EOF" >> $GITHUB_OUTPUT
echo "$changelog" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changelog.outputs.changelog }}

0 comments on commit 4dc0cab

Please sign in to comment.