Skip to content

docs: add darkbot version printing in conf #13

docs: add darkbot version printing in conf

docs: add darkbot version printing in conf #13

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
tags:
- "*"
env:
DOCKER_HOST: ssh://root@darkbot
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install Task
run: |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '^1.22.5'
- name: Find tags
id: branch_name
run: |
echo "SOURCE_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# SOURCE_NAME: The branch or the tag
# SOURCE_BRANCH: The branch or empty
# SOURCE_TAG: The tag or empty
- name: Echo tags
run: |
echo $SOURCE_NAME
echo $SOURCE_BRANCH
echo $SOURCE_TAG
env:
SOURCE_NAME: ${{ env.SOURCE_NAME }}
SOURCE_BRANCH: ${{ env.SOURCE_BRANCH }}
SOURCE_TAG: ${{ env.SOURCE_TAG }}
- name: Docker login
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login --username darkwind8 --password-stdin
- name: Install ssh key
run: |
mkdir ~/.ssh | true
echo "${{ secrets.SSH_KEY_BASE64 }}" | base64 --decode > ~/.ssh/id_rsa
echo "Host darkbot" > ~/.ssh/config
echo " HostName 95.217.237.232" >> ~/.ssh/config
echo " User root" >> ~/.ssh/config
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
echo " IdentitiesOnly yes" >> ~/.ssh/config
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
ssh-keyscan -H 95.217.237.232 >> ~/.ssh/known_hosts | true
ssh-keyscan -H darkbot >> ~/.ssh/known_hosts | true
- name: Build image
env:
SOURCE_NAME: ${{ env.SOURCE_NAME }}
run: docker build --build-arg "BUILD_VERSION=$SOURCE_NAME" --tag darkwind8/darkbot:$SOURCE_NAME .
- name: Push image
env:
SOURCE_NAME: ${{ env.SOURCE_NAME }}
run: |
docker push darkwind8/darkbot:$SOURCE_NAME
docker tag darkwind8/darkbot:$SOURCE_NAME darkwind8/darkbot:staging
docker push darkwind8/darkbot:staging
- name: Install arm64 redock at server (not amd64 in my case)
run: ssh root@darkbot 'curl -L $(curl -Ls -o /dev/null -w %{url_effective} https://github.com/darklab8/redock/releases/latest | sed "s/releases\/tag/releases\/download/")/redock-linux-arm64 -o /usr/local/bin/redock && chmod 777 /usr/local/bin/redock'
- name: Run redock
run: ssh root@darkbot 'redock --ctr=darkbot-staging --strict_pull=true'