Template repository for GitHub Actions
- Docker Hub: devopsinfra/template-action:latest
- GitHub Packages: ghcr.io/devops-infra/template-action:latest
- Baseline for GitHub Actions for DevOps-Infra projects
Check also other actions from DevOps-Infra
This action supports three tag levels for flexible versioning:
vX: latest patch of the major version (e.g.,v1).vX.Y: latest patch of the minor version (e.g.,v1.2).vX.Y.Z: fixed to a specific release (e.g.,v1.2.3).
- name: Run the Action
uses: devops-infra/[email protected]
env:
barfoo: foobaz
with:
foobar: bazbar
debug: false
# github_token: ${{ secrets.GITHUB_TOKEN }}| Variable | Description |
|---|---|
barfoo |
Sample environment variable. |
| Input | Required | Default | Description |
|---|---|---|---|
foobar |
No | foobar |
Sample input used by the action. |
debug |
No | false |
Enable verbose debug logging. |
github_token |
No | For authenticated GitHub requests. |
| Output | Description |
|---|---|
foobar |
Echo of provided foobar input. |
barfoo |
Duplicate of foobar for demo use. |
Run the Action with defaults.
name: Run the Action on each commit
on: [push]
jobs:
template-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: devops-infra/template-action@v1Run the Action with set inputs.
name: Run the Action on each commit
on: [push]
jobs:
template-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: devops-infra/template-action@v1
with:
foobar: hello
debug: 'true'Run the Action with a specific version tag.
name: Run the Action on each commit
on: [push]
jobs:
template-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: devops-infra/[email protected]
id: Pin patch version
- uses: devops-infra/[email protected]
id: Pin minor version
- uses: devops-infra/template-action@v1
id: Pin major versionWorkflows included:
- (Auto) Create Pull Request (
.github/workflows/auto-create-pull-request.yml)- Trigger: push to any branch except
masteranddependabot/**. - Jobs:
- Lint
- Build and push multi-platform test image, and inspect manifest
- Create pull request
- Trigger: push to any branch except
- (Auto) Create release (
.github/workflows/auto-create-release.yml)- Trigger:
pull_requestclosed andpushtorelease/**(runs only for merged PRs fromrelease/) - Jobs:
- Lint
- Tagging: create
vX.Y.Z; updatevX.YandvX(fails if full tag exists on remote) - Build and push multi-platform image, and inspect manifest
- Publish GitHub Release
- Update Docker hub description
- Trigger:
- (Cron) Weekly dependency build (
.github/workflows/cron-check-dependencies.yml)- Trigger: Weekly on Monday at 08:00 UTC
- Jobs:
- Lint
- Build and push multi-platform test image, and inspect manifest
- (Manual) Update version (
.github/workflows/manual-update-version.yml)- Trigger: manual
workflow_dispatchwithtype(patch|minor|major|set) xorversionwhentype=setpushes torelease/**branch and creates a pull request to create a new release - Jobs:
- Update version: bump or set; output
REL_VERSION - Build and push multi-platform image, and inspect manifest
- Create pull request, approve to create a release
- Update version: bump or set; output
- Trigger: manual
Prerequisites:
- Docker with Buildx,
- Task (installed via workflow or from https://taskfile.dev),
- gnu-sed if on macOS (
brew install gnu-sed), - pre-commit (optional).
Common tasks:
# Run all linters
task lint
# Build multi-arch images locally (no push)
task docker:build
# Push images (requires DOCKER_TOKEN and GITHUB_TOKEN)
DOCKER_TOKEN=... GITHUB_TOKEN=... task docker:pushPre-commit hooks:
brew install pre-commit
task pre-commit:install
task pre-commitContributions are welcome! See CONTRIBUTING. This project is licensed under the MIT License - see the LICENSE file for details.
This project is licensed under the MIT License - see the LICENSE file for details.
If you have any questions or need help, please:
- π Create an issue
- π Star this repository if you find it useful!