Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/soulsbros/cicd-template

Shared template for GitHub Actions
https://github.com/soulsbros/cicd-template

automation cicd docker template

Last synced: 2 days ago
JSON representation

Shared template for GitHub Actions

Awesome Lists containing this project

README

        

# CICD-template

![Test workflow](https://github.com/steeven9/CICD-template/actions/workflows/test.yml/badge.svg)

Shared template for GitHub Actions

## Usage

For example, to build on all branches and tags, add this to `.github/workflows/your-workflow.yml`:

```yaml
name: your-workflow

on:
push:
branches:
- "*"
tags:
- "*"

jobs:
build-tags:
# Build and push the image with the tag name
uses: steeven9/CICD-template/.github/workflows/docker-build.yml@main
if: github.ref_type == 'tag'
with:
image-name: some-org/some-image:${{ github.ref_name }} # TODO adapt to your needs
push: true
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

build-branches:
# Build all branches but push only in main
uses: steeven9/CICD-template/.github/workflows/docker-build.yml@main
if: github.ref_type == 'branch'
with:
image-name: some-org/some-image:latest # TODO adapt to your needs
push: ${{ github.ref_name == 'main' }}
ping_webhook: ${{ github.ref_name == 'main' }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
```

You can also override the Dockerfile location with the `dockerfile` input.

## Resources

### Actions used

### Documentation