Tweak dev CI to use a clean environment every time

This commit is contained in:
Skylar Grant 2025-01-31 19:38:42 -05:00
parent efcf613ea4
commit 7a88b3090b

View File

@ -1,10 +1,16 @@
name: NodBot PE Dockerization name: NodBot PE Dockerization
######################################################
# Creates a new Docker image of nodbot-dev, pushes #
# it to DockerHub, and restarts the container. #
######################################################
# Run when a new tag for dev is pushed
on: on:
push: push:
tags: tags:
- 'v*-dev*' - 'v*-dev*'
# Pull DockerHub credentials from secrets
env: env:
DHUB_UNAME: ${{ secrets.DHUB_UNAME }} DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
DHUB_PWORD: ${{ secrets.DHUB_PWORD }} DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
@ -13,21 +19,17 @@ jobs:
build: build:
runs-on: self-hosted runs-on: self-hosted
steps: steps:
- name: Clean up old environment
run: |
rm -rf /var/lib/act_runner/nodbot
rm -rf /var/lib/act_runner/nodbot-dev
- name: Pull latest from Git - name: Pull latest from Git
run: | run: |
echo "Ref: ${{ gitea.ref_name }}"
echo "Branch: tags/${{ gitea.ref_name }}" echo "Branch: tags/${{ gitea.ref_name }}"
pwd cd /var/lib/act_runner
whoami git clone https://git.vfsh.dev/voidf1sh/nodbot
mkdir -p /var/lib/act_runner/ cd nodbot
cd /var/lib/act_runner/
if [ ! -d "nodbot" ]; then
git clone https://git.vfsh.dev/voidf1sh/nodbot
cd nodbot
else
cd nodbot
git checkout main
git pull
fi
git checkout tags/${{ gitea.ref_name }} git checkout tags/${{ gitea.ref_name }}
- name: Build the Docker image - name: Build the Docker image
run: | run: |