thepopebot 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/postinstall.js +17 -0
- package/package.json +1 -1
- package/templates/.env.example +4 -1
- package/templates/.github/workflows/run-job.yml +1 -1
- package/templates/docker-compose.yml +2 -2
- package/templates/docker/runner/Dockerfile +0 -38
- package/templates/docker/runner/entrypoint.sh +0 -41
- /package/templates/docker/{event_handler → event-handler}/Dockerfile +0 -0
package/bin/postinstall.js
CHANGED
|
@@ -38,6 +38,23 @@ function walk(dir) {
|
|
|
38
38
|
return files;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// Write THEPOPEBOT_VERSION to .env so docker-compose can pin the image tag
|
|
42
|
+
const envPath = path.join(projectRoot, '.env');
|
|
43
|
+
if (fs.existsSync(envPath)) {
|
|
44
|
+
const ownPkgPath = path.join(__dirname, '..', 'package.json');
|
|
45
|
+
try {
|
|
46
|
+
const ownPkg = JSON.parse(fs.readFileSync(ownPkgPath, 'utf8'));
|
|
47
|
+
const version = ownPkg.version;
|
|
48
|
+
let envContent = fs.readFileSync(envPath, 'utf8');
|
|
49
|
+
if (envContent.match(/^THEPOPEBOT_VERSION=.*/m)) {
|
|
50
|
+
envContent = envContent.replace(/^THEPOPEBOT_VERSION=.*/m, `THEPOPEBOT_VERSION=${version}`);
|
|
51
|
+
} else {
|
|
52
|
+
envContent = envContent.trimEnd() + `\nTHEPOPEBOT_VERSION=${version}\n`;
|
|
53
|
+
}
|
|
54
|
+
fs.writeFileSync(envPath, envContent);
|
|
55
|
+
} catch {}
|
|
56
|
+
}
|
|
57
|
+
|
|
41
58
|
const changed = [];
|
|
42
59
|
for (const relPath of walk(templatesDir)) {
|
|
43
60
|
const src = path.join(templatesDir, relPath);
|
package/package.json
CHANGED
package/templates/.env.example
CHANGED
|
@@ -49,6 +49,9 @@ TELEGRAM_CHAT_ID=
|
|
|
49
49
|
# If not set, Traefik uses a self-signed certificate
|
|
50
50
|
# LETSENCRYPT_EMAIL=
|
|
51
51
|
|
|
52
|
-
#
|
|
52
|
+
# thepopebot version — auto-set by postinstall, used by docker-compose for image tags
|
|
53
|
+
# THEPOPEBOT_VERSION=
|
|
54
|
+
|
|
55
|
+
# Custom Docker images (optional, overrides the default stephengpope/thepopebot images)
|
|
53
56
|
# EVENT_HANDLER_IMAGE_URL=
|
|
54
57
|
# JOB_IMAGE_URL=
|
|
@@ -20,7 +20,7 @@ services:
|
|
|
20
20
|
restart: unless-stopped
|
|
21
21
|
|
|
22
22
|
event_handler:
|
|
23
|
-
image: ${EVENT_HANDLER_IMAGE_URL:-stephengpope/thepopebot
|
|
23
|
+
image: ${EVENT_HANDLER_IMAGE_URL:-stephengpope/thepopebot:event-handler-${THEPOPEBOT_VERSION:-latest}}
|
|
24
24
|
volumes:
|
|
25
25
|
- ./.env:/app/.env
|
|
26
26
|
- ./config:/app/config
|
|
@@ -38,7 +38,7 @@ services:
|
|
|
38
38
|
restart: unless-stopped
|
|
39
39
|
|
|
40
40
|
runner:
|
|
41
|
-
image:
|
|
41
|
+
image: myoung34/github-actions-runner:latest
|
|
42
42
|
environment:
|
|
43
43
|
REPO_URL: https://github.com/${GH_OWNER}/${GH_REPO}
|
|
44
44
|
ACCESS_TOKEN: ${GH_TOKEN}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
FROM ubuntu:24.04
|
|
2
|
-
|
|
3
|
-
ARG RUNNER_VERSION=2.321.0
|
|
4
|
-
ARG RUNNER_ARCH=x64
|
|
5
|
-
|
|
6
|
-
RUN apt-get update && apt-get install -y \
|
|
7
|
-
curl \
|
|
8
|
-
jq \
|
|
9
|
-
git \
|
|
10
|
-
ca-certificates \
|
|
11
|
-
gnupg \
|
|
12
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
13
|
-
|
|
14
|
-
# Install Docker CLI (talks to host daemon via socket)
|
|
15
|
-
RUN install -m 0755 -d /etc/apt/keyrings \
|
|
16
|
-
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
|
|
17
|
-
&& chmod a+r /etc/apt/keyrings/docker.gpg \
|
|
18
|
-
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu noble stable" > /etc/apt/sources.list.d/docker.list \
|
|
19
|
-
&& apt-get update && apt-get install -y docker-ce-cli \
|
|
20
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
21
|
-
|
|
22
|
-
# Create non-root runner user
|
|
23
|
-
RUN useradd -m -s /bin/bash runner \
|
|
24
|
-
&& usermod -aG root runner
|
|
25
|
-
|
|
26
|
-
# Download and extract GitHub Actions runner
|
|
27
|
-
WORKDIR /home/runner
|
|
28
|
-
RUN curl -fsSL "https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${RUNNER_ARCH}-${RUNNER_VERSION}.tar.gz" \
|
|
29
|
-
| tar xz \
|
|
30
|
-
&& ./bin/installdependencies.sh \
|
|
31
|
-
&& chown -R runner:runner /home/runner
|
|
32
|
-
|
|
33
|
-
COPY entrypoint.sh /entrypoint.sh
|
|
34
|
-
RUN chmod +x /entrypoint.sh
|
|
35
|
-
|
|
36
|
-
USER runner
|
|
37
|
-
|
|
38
|
-
ENTRYPOINT ["/entrypoint.sh"]
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
set -e
|
|
3
|
-
|
|
4
|
-
# Required environment variables
|
|
5
|
-
: "${REPO_URL:?REPO_URL is required}"
|
|
6
|
-
: "${ACCESS_TOKEN:?ACCESS_TOKEN is required}"
|
|
7
|
-
|
|
8
|
-
RUNNER_NAME="${RUNNER_NAME:-thepopebot-runner}"
|
|
9
|
-
LABELS="${LABELS:-self-hosted,thepopebot}"
|
|
10
|
-
|
|
11
|
-
# Generate a registration token from the PAT
|
|
12
|
-
REG_TOKEN=$(curl -s -X POST \
|
|
13
|
-
-H "Authorization: token ${ACCESS_TOKEN}" \
|
|
14
|
-
-H "Accept: application/vnd.github.v3+json" \
|
|
15
|
-
"${REPO_URL/github.com/api.github.com/repos}/actions/runners/registration-token" \
|
|
16
|
-
| jq -r '.token')
|
|
17
|
-
|
|
18
|
-
if [ "$REG_TOKEN" = "null" ] || [ -z "$REG_TOKEN" ]; then
|
|
19
|
-
echo "Failed to get registration token. Check ACCESS_TOKEN permissions."
|
|
20
|
-
exit 1
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
# Configure the runner
|
|
24
|
-
./config.sh \
|
|
25
|
-
--url "$REPO_URL" \
|
|
26
|
-
--token "$REG_TOKEN" \
|
|
27
|
-
--name "$RUNNER_NAME" \
|
|
28
|
-
--labels "$LABELS" \
|
|
29
|
-
--unattended \
|
|
30
|
-
--replace
|
|
31
|
-
|
|
32
|
-
# Deregister on shutdown
|
|
33
|
-
cleanup() {
|
|
34
|
-
echo "Removing runner..."
|
|
35
|
-
./config.sh remove --token "$REG_TOKEN" 2>/dev/null || true
|
|
36
|
-
}
|
|
37
|
-
trap cleanup SIGTERM SIGINT
|
|
38
|
-
|
|
39
|
-
# Start the runner (blocks until stopped)
|
|
40
|
-
./run.sh &
|
|
41
|
-
wait $!
|
|
File without changes
|