GithubHelp home page GithubHelp logo

aplinkosministerija / reusable-workflows Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 0.0 289 KB

Reusable workflows for developing GitHub actions

License: MIT License

Dockerfile 100.00%
github-actions reusable-workflows

reusable-workflows's Introduction

Reusable Workflows for Developing GitHub Actions

The repository contains reusable workflows and provides a collection of workflow templates that facilitate the development of GitHub actions across several repositories.

Background

These workflows are designed to help streamline common development tasks, such as building and testing code, deploying applications. By using reusable workflows, developers can save time and effort by avoiding the need to recreate the same workflows across multiple repositories. Additionally, the repository includes documentation and best practices for creating and sharing reusable workflows.

Available workflows

Build & push docker image

This workflow automates the building, tagging, and pushing of Docker images to GitHub's Container Registry.

Usage

docker-build-push:
  uses: AplinkosMinisterija/reusable-workflows/.github/workflows/docker-build-push.yml@main
  with:
    docker-image: ghcr.io/AplinkosMinisterija/example-monorepo
    docker-context: backend
    environment: production
    runs-on: ubuntu-latest
    docker-platforms: 'linux/amd64,linux/arm64'
    latest-tag: true
    git-ref: 1084a50
    push: true

For additional information see docker-build-push.yml

Using workflows in real-life

Continuous deployment

To ensure continuous deployment in a real-world scenario, I would like to create workflows that:

  • Utilize Trunk-based development as a version control management practice.
  • Have three environments:
    • Development, used for testing non-production ready features.
    • Staging, which always points to the main branch.
    • Production which deploys after publishing new release in GitHub and uses Semantic Versioning.
  • Include caching to speed up the process.
  • Be able to push to GitHub Container registry with meaningful image tags.
  • Build a multi-arch image that supports AMD64 and ARM64 architectures.

Examples

deploy-development.yml
name: Deploy to Development

on:
  workflow_dispatch:
    inputs:
      git-ref:
        description: Git Ref (Optional)
        required: false

concurrency: deploy-to-development

jobs:
  docker-build-push:
    name: Build & push docker image
    uses: AplinkosMinisterija/reusable-workflows/.github/workflows/docker-build-push.yml@main
    with:
      docker-image: ghcr.io/aplinkosministerija/example-monorepo
      docker-context: backend
      environment: development
      runs-on: ubuntu-latest
      git-ref: ${{ github.event.inputs.git-ref }}
      push: true

  deploy:
    name: My Deployment
    needs: [ docker-build-push ]
    runs-on: ubuntu-latest

    steps:
      - run: echo "TODO"
deploy-staging.yml
name: Deploy to Staging

on:
  push:
    branches: [ main ]

concurrency: deploy-to-staging

jobs:
  docker-build-push:
    name: Build & push docker image
    uses: AplinkosMinisterija/reusable-workflows/.github/workflows/docker-build-push.yml@main
    with:
      docker-image: ghcr.io/aplinkosministerija/example-monorepo
      docker-context: backend
      environment: staging
      runs-on: ubuntu-latest
      push: true

  deploy:
    name: My Deployment
    needs: [ docker-build-push ]
    runs-on: ubuntu-latest

    steps:
      - run: echo "TODO"
deploy-production.yml
name: Deploy to Production

on:
  push:
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+'

concurrency: deploy-to-production

jobs:
  docker-build-push:
    name: Build & push docker image
    uses: AplinkosMinisterija/reusable-workflows/.github/workflows/docker-build-push.yml@main
    with:
      docker-image: ghcr.io/aplinkosministerija/example-monorepo
      docker-context: backend
      environment: production
      runs-on: ubuntu-latest
      latest-tag: true
      push: true

  deploy:
    name: My Deployment
    needs: [ docker-build-push ]
    runs-on: ubuntu-latest

    steps:
      - run: echo "TODO"

Inspiration

The inspiration behind this project comes from actions/reusable-workflows.

License

The scripts and documentation in this project are released under the MIT License

Contributing

Contributions are welcome! See Contributor's Guide

reusable-workflows's People

Contributors

dependabot[bot] avatar vycius avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.