This repository contains a collection of GitHub Actions that are used in various projects. These actions are designed to be used in conjunction with other actions and are not standalone.
- docker-build-push - Build and optionally push a Docker image
- github-pages - Deploy a static site to GitHub Pages
- hatch-docs - Build Documentation with hatch
- hatch-lint - Lint Python Code with hatch
- hatch-setup - Setup Python Environment with hatch
- hatch-test - Test Python Code with hatch
- hatch-version - Get the Version of a Python Package with hatch
- semantic-release - Automate Semantic Versioning and Releases
The docker-build-push
action is a composite action that uses the docker/build-push-action
to
build and push a docker image to a registry.
push
- Push the image to the registry. Default:false
name
- The name of the package to build. Requiredversion
- The version of the package to build. Requiredregistry
- The registry to push the image to. Default:juftin
latest
- Tag the image as latest. Default:true
username
- The username for the registry. Default:""
password
- The password for the registry. Default:""
context
- The context to use for the build. Default:.
load
- Load the image into docker after building. Default:false
- name: Docker Build and Push
uses: juftin/actions/docker-build-push@v1
with:
push: true
name: "my-package"
version: "1.0.0"
registry: "juftin"
latest: true
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
The github-pages
action is a composite action that uses
the actions/configure-pages
, actions/upload-pages-artifact
,
and actions/deploy-pages
actions to deploy a static site to GitHub Pages.
path
- The directory to publish. Default:site
page_url
- The URL of the deployed site
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Set up Github Workspace
uses: actions/checkout@v4
- name: Setup Hatch
uses: juftin/actions/hatch-setup@v1
with:
python_version: "3.11"
- name: Build Docs
uses: juftin/actions/hatch-docs@v1
- name: Publish Docs
uses: juftin/actions/github-pages@v1
id: deployment
The hatch-docs
action is a composite action that uses hatch to build documentation.
path
- The directory to publish. Default:site
env
- hatch docs environment. Default:docs
build_command
- Docs build command to run. Default:build
shell
- Shell to use. Default:bash
- name: Setup Hatch
uses: juftin/actions/hatch-setup@v1
with:
python_version: "3.11"
- name: Build Documentation
uses: juftin/actions/hatch-docs@v1
The hatch-lint
action is a composite action that uses hatch to lint Python code.
env
- hatch linting environment. Default:lint
style_command
- Style Command to run. Default:style
typing_command
- Typing Command to run. Default:typing
shell
- Shell to use. Default:bash
- name: Setup Hatch
uses: juftin/actions/hatch-setup@v1
with:
python_version: "3.11"
- name: Lint Python Code
uses: juftin/actions/hatch-lint@v1
The hatch-setup
action is a composite action that uses hatch to setup a Python environment.
python_version
- Python Version to install. Requiredcreate_env
- Create a new virtual environment. Default:""
additional_dependencies
- Additional dependencies to install. Default:""
shell
- Shell to use for running commands. Default:bash
- name: Setup Python Environment
uses: juftin/actions/hatch-setup@v1
with:
python_version: "3.11"
additional_dependencies: "pre-commit black"
The hatch-test
action is a composite action that uses hatch to run tests.
This action can be used in a matrix to test multiple versions of Python - or
it can be used in a standalone environment as well.
env
- hatch testing environment. Default:test
coverage_command
- Coverage Command to run. Default:cov
shell
- Shell to use. Default:bash
matrix
- Test matrix. Default:""
jobs:
test:
name: test
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { name: Python 3.10, python: "3.10" }
- { name: Python 3.9, python: "3.9" }
- { name: Python 3.8, python: "3.8" }
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Hatch
uses: juftin/actions/hatch-setup@v1
with:
python_version: ${{ matrix.python }}
- name: Test
uses: juftin/actions/hatch-test@v1
with:
env: matrix
coverage_command: cov
matrix: "+py=${{ matrix.python }}"
The hatch-version
action is a composite action that uses hatch to
get the version of a Python package and its name.
- name: Setup Hatch
uses: juftin/actions/hatch-setup@v1
with:
python_version: "3.11"
- name: Get Package Name and Version
uses: juftin/actions/hatch-version@v1
id: package
- name: Echo Package Info
run: |
echo "Package Name: ${{ steps.package.outputs.name }}"
echo "Package Version: ${{ steps.package.outputs.version }}"
The semantic-release
action is a composite action
that uses semantic-release to automate the versioning and
releasing of a package.
semantic-release
comes with support for the following plugins
(they must be specified in your release configuration file for them to work):
@semantic-release/changelog
- Generate a changelog file@semantic-release/commit-analyzer
- Analyze commits with conventional-changelog@semantic-release/exec
- Run commands during the release process@semantic-release/git
- Commit release assets to the repository@semantic-release/github
- Create a GitHub release + comment on issues and PRs@semantic-release/npm
- Publish a package to npm@semantic-release/release-notes-generator
- Generate release notes for the commits in the releasesemantic-release-gitmoji
- Use gitmoji for commit messagessemantic-release-major-tag
- Create a major tag for releasessemantic-release-pypi
- Publish a package to PyPIsemantic-release-replace-plugin
- Replace text in files with release informationsemantic-release-slack-bot
- Notify a Slack channel of a release
You must also have a semantic-release configuration file in your repository root for this action to work.
github_token
- GitHub Token. Required
- name: Semantic Release
uses: juftin/actions/semantic-release@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}