Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Demonstration of running apps using Action. Not intended for real usage.

Notifications You must be signed in to change notification settings

vladkosinov/github-action-daemon

Repository files navigation

github-action-daemon

Disclaimer ⚠️⚠️⚠️

Running a daemon as a server and accessing it from outside the VM is not within the terms of use for Actions.

This package just a demonstration of an easy way of running applications using GitHub Actions and not intended to be used by anyone.

Please don't do this.

Description

Runs a given command and handles its restarts:

  • waits for the finish of all other runs of the same workflow before starting the command
  • sends SIGTERM to the running command once a new run appear

Inputs

command

Required The command to run

github-token [optional]

Used to poll GitHub API for statuses of the same workflow that running the daeomn.

Default: ${{ github.token }}

Motivation

To test services manually or run live repo examples

Example usage

Running telegram bot

Example repo: github-action-daemon-example-telegram-bot

name: Daemon demo
on:
  push:
    branches:
      - main
  schedule:
    # # # # # # # # # #
    # restart each 1 hour
    - cron: "0 */1 * * *"
    # # # # # # # # # # 

jobs:
  start:
    runs-on: ubuntu-latest
    name: Start daemon
    steps:
      - uses: actions/checkout@v2

      - uses: vladkosinov/github-action-daemon@v1.0.0
        env:
          BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
        with:
          command: "node .github/workflows/demo/index.js"

Running docker-compose bot and exposing URL

Example repo: github-action-daemon-example-docker-compose

name: Running
on:
  push:
    branches:
      - main
  schedule:
    - cron: "0 */1 * * *"

jobs:
  start:
    runs-on: ubuntu-latest
    name: Start

    steps:
      - uses: actions/checkout@v2

      - uses: actions/checkout@v2
        with:
          repository: 'docker/awesome-compose'
          path: 'awesome-compose'
      
      - uses: vladkosinov/github-action-daemon@v1.0.0
        with:
          command: |
            #
            # localtunnel-live.sh creates tunnel and pushes URL to the README.md
            # https://github.com/vladkosinov/github-action-daemon-example-docker-compose/blob/main/localtunnel-live.sh
            #
            ./localtunnel-live.sh & (cd awesome-compose/react-rust-postgres && docker-compose up)

About

Demonstration of running apps using Action. Not intended for real usage.

Resources

Stars

Watchers

Forks

Packages