Sign inSign up

devopsinfra/template-action

Sponsored OSS

By DevOps Infra

โ€ขUpdated 13 days ago

Template repository for GitHub Actions

Image
Developer tools
0

10K+

devopsinfra/template-action repository overview

โ ๐Ÿš€ GitHub Action template

Template repository for GitHub Actions

โ ๐Ÿ“ฆ Available on

โ โœจ Features

Check also other actions from DevOps-Infraโ 

โ ๐Ÿ“Š Badges

GitHub repo GitHub last commit GitHub code size in bytes GitHub license โ 
DockerHub Docker version Image size Docker Pulls โ 

โ ๐Ÿท๏ธ Version Tags: vX, vX.Y, vX.Y.Z

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).

โ ๐Ÿ“– API Reference

    - name: Run the Action
      uses: devops-infra/[email protected]
      env:
        barfoo: foobaz
      with:
        foobar: bazbar
        debug: false
        # github_token: ${{ secrets.GITHUB_TOKEN }}
โ ๐Ÿ”จ Environment Variables
VariableDescription
barfooSample environment variable.
โ ๐Ÿ”ง Input Parameters
InputRequiredDefaultDescription
foobarNofoobarSample input used by the action.
debugNofalseEnable verbose debug logging.
github_tokenNoFor authenticated GitHub requests.
โ ๐Ÿ“ค Output Parameters
OutputDescription
foobarEcho of provided foobar input.
barfooDuplicate of foobar for demo use.

โ ๐Ÿ’ป Usage Examples

โ ๐Ÿ“ Basic Example

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@v6

      - uses: devops-infra/template-action@v1
โ ๐Ÿ”€ Advanced Example

Run 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@v6

      - uses: devops-infra/template-action@v1
        with:
          foobar: hello
          debug: 'true'
โ ๐ŸŽฏ Use specific version

Pick the tag level based on your stability needs:

  • vX.Y.Z: exact immutable release (most predictable)
  • vX.Y: latest patch within one minor line
  • vX: latest patch within one major line
name: Run the Action on each commit
on: [push]
jobs:
  template-action:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - 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 version

โ ๐Ÿ—๏ธ CI/CD

Workflows included:

  • (Auto) Pull Request Create (.github/workflows/auto-pull-request-create.yml)
    • Trigger: push to any branch except master and dependabot/**.
    • Jobs:
      • Lint
      • Build and push multi-platform test image, and inspect manifest
      • Create pull request
  • (Auto) Create release (.github/workflows/auto-create-release.yml)
    • Trigger: pull_request closed and push to release/** (runs only for merged PRs from release/)
    • Jobs:
      • Lint
      • Tagging: create vX.Y.Z; update vX.Y and vX (fails if full tag exists on remote)
      • Build and push multi-platform image, and inspect manifest
      • Publish GitHub Release
      • Update Docker hub description
  • (Cron) Weekly dependency build (.github/workflows/cron-dependency-update.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-release-create.yml)
    • Trigger: manual workflow_dispatch with type (patch|minor|major|set) xor version when type=set pushes to release/** 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

โ ๐Ÿง‘โ€๐Ÿ’ป Development

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:push

Pre-commit hooks:

brew install pre-commit
task pre-commit:install
task pre-commit

โ ๐Ÿค Contributing

Contributions are welcome! See CONTRIBUTINGโ . This project is licensed under the MIT License - see the LICENSEโ  file for details.

โ ๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSEโ  file for details.

โ ๐Ÿ’ฌ Support

If you have any questions or need help, please:

  • ๐Ÿ“ Create an issueโ 
  • ๐ŸŒŸ Star this repository if you find it useful!

โ ๐Ÿงช End-to-End Validation

Template action E2E validation is now part of the centralized org flow.

  • Pull requests: runs automatically via reusable org workflow hooks.
  • Release branch prepare: runs automatically against release candidate refs.
  • Release create: runs automatically against production release refs.

Manual execution options:

  • Repository-local caller workflow: .github/workflows/manual-e2e-validate.yml
  • Centralized workflow directly: devops-infra/triglav/.github/workflows/e2e-action-template-action.yml

Execution modes:

  • mode=ref validates ref-oriented E2E paths against stable pinned action refs.
  • mode=image is wired but currently placeholder-only in the central E2E workflow for this action.

Example trigger inputs:

mode=ref
mode=image
image_tag=v1.2.3-test

โ Forking

To publish images from a fork, set these variables so Task uses your registry identities: DOCKER_USERNAME, DOCKER_ORG_NAME, GITHUB_USERNAME, GITHUB_ORG_NAME.

Two supported options (environment variables take precedence over .env):

# .env (local only, not committed)
DOCKER_USERNAME=your-dockerhub-user
DOCKER_ORG_NAME=your-dockerhub-org
GITHUB_USERNAME=your-github-user
GITHUB_ORG_NAME=your-github-org
# Shell override
DOCKER_USERNAME=your-dockerhub-user \
DOCKER_ORG_NAME=your-dockerhub-org \
GITHUB_USERNAME=your-github-user \
GITHUB_ORG_NAME=your-github-org \
task docker:build

Recommended setup:

  • Local development: use a .env file.
  • GitHub Actions: set repo variables for the four values above, and secrets for DOCKER_TOKEN and GITHUB_TOKEN.

Publish images without a release:

  • Run the (Manual) Release Create workflow with build_only: true to build and push images without tagging a release.

Tag summary

Content type

Image

Digest

sha256:dd618c7fcโ€ฆ

Size

4.8 MB

Last updated

4 months ago

docker pull devopsinfra/template-action

This week's pulls

Pulls:

156

Last week