Get the config.env
file completely filled.
I use This docker-compose.yml file to build and start-up my Userge Workflow.
Make sure the branch name is main
and workflow name is also main
.
Plese read the comment lines inside the YAML File.
name: Serge CI
on:
workflow_dispatch:
env:
PAT: ${{ secrets.GH_TOKEN }}
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Set Git Configs & Secrets
run: |
# Replace your github name/id and email address in the next lines
# and add your github token as `GH_TOKEN` repo secret
git config --global user.email "Your-github-commit-or-actual-email-address"
git config --global user.name "Your-github-username"
git config --global color.ui true
git config --global credential.helper store
echo "https://Your-github-username:${PAT}@github.com" > ~/.git-credentials
- name: Build and Run Userge
# the step will run for exactly 350 minutes
timeout-minutes: 350
continue-on-error: true
run: |
# Prepare: Just To Populate Workflow Output Window
until [[ "${SECONDS_LEFT:=10}" = 0 ]]; do
printf "Please wait %ss ...\n" "${SECONDS_LEFT}"
sleep 0.5
SECONDS_LEFT=$(echo "${SECONDS_LEFT} - 0.5" | bc)
done && unset SECONDS_LEFT
# You need account in Dockerhub
# Put the user id as `DOCKER_USERNAME` and token (not password) as `DOCKERHUB_TOKEN` in the repo secret
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin &>/dev/null
echo "::group::Prepare Repos"
git clone YOUR-DESIRED-USERGE-CLONE-or-FORK-GIT-URL bot && cd bot
# Use the below line if you are fetching the config from outside the repository
curl -sL YOUR-USERGE-CONFIG-DIRECT-URL -o config.env
# Use the custom docker-compose file modified by me
curl -sL https://gist.github.com/rokibhasansagar/1422c565ca24a273eafee02eb31c420d/raw/Userge_Inhouse.docker-compose.yml -o docker-compose.yml
echo "::endgroup::"
echo "::group::Build Containers"
# The docker container will be built first, then my slimhub_actions will clean space
docker-compose up -d &
sleep 20s && curl -sL https://github.com/rokibhasansagar/slimhub_actions/raw/main/cleanup.sh | bash 2>/dev/null
echo "::endgroup::"
echo "::group::Startup Containers"
docker-compose logs -f
echo "::endgroup::"
- name: Trigger new workflow
continue-on-error: true
run: |
curl -X POST --header "Authorization: token ${PAT}" https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/workflows/main.yml/dispatches -d '{"ref":"main"}'
That's all.