Skip to content
FreakMediaLPPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

78 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Workflows

A collection of reusable GitHub Actions workflows (on: workflow_call) for use in other repositories.

Call one from your repository with uses: and pass the required secrets:

jobs:
  deploy:
    uses: FreakMediaLP/Workflows/.github/workflows/deploy-docker.yml@v1
    with:
      registry-host: docker.example.com   # omit for ghcr.io
      image-name: my-app
      version: latest
      container-name: my-app
    secrets:
      SSH_HOST: ${{ secrets.SSH_HOST }}
      SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
      SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
      REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
      REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}

Note on structure: All files live directly in .github/workflows/. GitHub Actions does not support subfolders for workflows (including reusable ones), so grouping is done via naming prefixes (build-*, deploy-*, push-*).

Overview

Build (Docker)

Workflow Purpose
build-docker.yml Build & push a Docker image to ghcr.io or a custom registry

Deploy (Docker)

Workflow Purpose
deploy-docker.yml Deploy an image via docker run from ghcr.io or a custom registry
deploy-docker-compose.yml Deploy via docker compose from ghcr.io or a custom registry

Deploy (Code)

Workflow Purpose
deploy-to-server.yml rsync code to a server and restart via stop/start commands
deploy-to-tmux.yml rsync code to a server and run it inside a tmux session
push-to-server.yml rsync code to a server (no restart)

Workflow Inputs

All Docker workflows support GitHubs ghcr.io and custom registries. The registry is selected via the registry-host input, provide your own hostname for a custom registry or leave it empty, to use to use GitHubs ghcr.io Container Registry.

Secrets: All workflows explicitly declare their secret inputs. When using ghcr.io, authentication uses github.actor / GITHUB_TOKEN automatically. For a custom registry, you must pass REGISTRY_USER and REGISTRY_PASSWORD. All deploy workflows require SSH_HOST, SSH_USERNAME, and SSH_PRIVATE_KEY.

build-docker.yml

Input Required Type Default Description
registry-host No string ghcr.io Hostname of the Docker registry. Set to your custom registry hostname, or omit to use ghcr.io.
image-name No string Repository name (owner/repo on ghcr.io) Name of the Docker image (e.g. myapp). Defaults to the repository name, or owner/repo on ghcr.io. Overrides the default when provided.
version Yes string - Version tag of the Docker image (e.g. latest, v1.2.0, feature-test).
dockerfile No string Dockerfile Path to the Dockerfile relative to the repository root (e.g. docker/frontend/Dockerfile).
build-args No string - Newline-separated list of Docker build arguments (e.g. ARG_NAME=value).
cleanup No boolean false Delete old package versions in ghcr.io after the build. Only applies to ghcr.io.
keep-versions No number 3 Minimum number of versions to keep when cleanup is enabled. Only applies to ghcr.io.
Secret Required Description
REGISTRY_USER No Username for registries other than ghcr.io
REGISTRY_PASSWORD No Password or access token for registries other than ghcr.io

deploy-docker.yml

Input Required Type Default Description
registry-host No string ghcr.io Hostname of the Docker registry. Set to your custom registry hostname, or omit to use ghcr.io.
image-name No string Repository name (owner/repo on ghcr.io) Name of the Docker image (e.g. myapp). Defaults to the repository name, or owner/repo on ghcr.io. Overrides the default when provided.
version Yes string - Version tag of the Docker image to deploy (e.g. latest, cb423f).
container-name Yes string - Name for the Docker container on the server. The old container with this name is stopped and replaced.
run-arguments No string - Additional arguments for docker run, separated by commas (e.g. --restart always, -p 80:80).
cleanup No boolean false Remove dangling Docker images for this image on the server after deploy.
Secret Required Description
SSH_HOST Yes Hostname or IP address of the deployment server
SSH_USERNAME Yes Username used to connect to the deployment server
SSH_PRIVATE_KEY Yes Private SSH key used to connect to the deployment server
REGISTRY_USER No Username for registries other than ghcr.io
REGISTRY_PASSWORD No Password or access token for registries other than ghcr.io

deploy-docker-compose.yml

Input Required Type Default Description
registry-host No string ghcr.io Hostname of the Docker registry. Set to your custom registry hostname, or omit to use ghcr.io.
remote-path Yes string - Directory on the server where the compose file is placed and docker compose is executed (e.g. /opt/docker/myapp).
compose-file No string docker-compose.yml Path to the compose file inside the calling repository.
cleanup No boolean false Run docker image prune -f on the server after deploy to remove dangling images.
Secret Required Description
SSH_HOST Yes Hostname or IP address of the deployment server
SSH_USERNAME Yes Username used to connect to the deployment server
SSH_PRIVATE_KEY Yes Private SSH key used to connect to the deployment server
REGISTRY_USER No Username for registries other than ghcr.io
REGISTRY_PASSWORD No Password or access token for registries other than ghcr.io

deploy-to-server.yml

Input Required Type Default Description
deploy_path Yes string - Path on the server where the code is deployed.
excluded_objects Yes string - Files and directories to keep on the server, separated by commas.
stop_command Yes string - Command to stop the running program before deploying.
start_command Yes string - Command to start the program after deploying.
Secret Required Description
SSH_HOST Yes Hostname or IP address of the deployment server
SSH_USERNAME Yes Username used to connect to the deployment server
SSH_PRIVATE_KEY Yes Private SSH key used to connect to the deployment server

deploy-to-tmux.yml

Input Required Type Default Description
deploy_path Yes string - Path on the server where the code is deployed.
excluded_objects Yes string - Files and directories to keep on the server, separated by commas.
session_name Yes string - Name of the tmux session to create. The old session is killed before deploying.
start_command Yes string - Command to run inside the new tmux session.
Secret Required Description
SSH_HOST Yes Hostname or IP address of the deployment server
SSH_USERNAME Yes Username used to connect to the deployment server
SSH_PRIVATE_KEY Yes Private SSH key used to connect to the deployment server

push-to-server.yml

Input Required Type Default Description
deploy_path Yes string - Path on the server where the code is deployed.
excluded_objects Yes string - Files and directories to keep on the server, separated by commas.
Secret Required Description
SSH_HOST Yes Hostname or IP address of the deployment server
SSH_USERNAME Yes Username used to connect to the deployment server
SSH_PRIVATE_KEY Yes Private SSH key used to connect to the deployment server

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors