main
HeNine 2 years ago
parent ff5824dd9e
commit 025e710d44

@ -1,34 +0,0 @@
name: Publish Docker
run-name: ${{ github.actor }} is building ${{ github.repository }}
on:
push:
branches:
- main
jobs:
Publish-Docker:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: https://github.com/actions/checkout@v3
- name: Install Docker
run: curl -fsSL https://get.docker.com | sh
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v2
- name: Login to registry
uses: docker/login-action@v2
with:
registry: git.raptorpond.com
username: henine
password: "${{secrets.PACKAGE_TOKEN}}"
- name: Build and push
uses: https://github.com/docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: git.raptorpond.com/${{ github.repository }}:latest

@ -26,7 +26,7 @@ jobs:
uses: https://github.com/actions-rs/cargo@v1 uses: https://github.com/actions-rs/cargo@v1
with: with:
command: publish command: publish
args: --index=https://git.raptorpond.com/henine/_cargo-index.git --token "${{ secrets.PACKAGE_TOKEN }}" args: --index=https://git.raptorpond.com/henine/_cargo-index.git --token "Bearer ${{ secrets.PACKAGE_TOKEN }}"
Publish-Docker: Publish-Docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -35,5 +35,31 @@ jobs:
- name: Check out repository code - name: Check out repository code
uses: https://github.com/actions/checkout@v3 uses: https://github.com/actions/checkout@v3
- name: Write release version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Install Docker
run: curl -fsSL https://get.docker.com | sh
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v2 uses: https://github.com/docker/setup-buildx-action@v2
- name: Login to registry
uses: docker/login-action@v2
with:
registry: git.raptorpond.com
username: henine
password: "${{ secrets.PACKAGE_TOKEN }}"
- name: Build and push
uses: https://github.com/docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags:
- git.raptorpond.com/${{ github.repository }}:latest
- git.raptorpond.com/${{ github.repository }}:${{ env.VERSION }}

2
Cargo.lock generated

@ -720,7 +720,7 @@ dependencies = [
[[package]] [[package]]
name = "rulebot" name = "rulebot"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"env_logger", "env_logger",
"exitcode", "exitcode",

@ -1,13 +1,13 @@
[package] [package]
name = "rulebot" name = "rulebot"
version = "0.1.0" version = "0.2.0"
edition = "2021" edition = "2021"
description = "Bot for Mastodon that runs a random cellular automaton on an 8-bit input." description = "Bot for Mastodon that runs a random cellular automaton on an 8-bit input."
readme = "README.md" readme = "README.md"
homepage = "https://mastodon.raptorpond.com/@rulebot" homepage = "https://mastodon.raptorpond.com/@rulebot"
repository = "https://git.raptorpond.com/henine/rulebot" repository = "https://git.raptorpond.com/henine/rulebot"
license = "MIT" license = "MIT"
exclude = ["/.*"] exclude = ["/.*", "logo.png"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

@ -0,0 +1,10 @@
version: "3.9"
services:
rulebot:
image: git.raptorpond.com/henine/rulebot:latest
restart: unless-stopped
environment:
- RULEBOT_MASTODON_TOKEN
- RULEBOT_POST_INTERVAL
labels:
- "com.centurylinklabs.watchtower.enable=true"

@ -65,7 +65,7 @@ async fn send_status(
) )
.form(&[ .form(&[
("status", format!("Rule: {}\n{}", rule, states)), ("status", format!("Rule: {}\n{}", rule, states)),
("visibility", String::from("private")), ("visibility", String::from("public")),
]) ])
.send() .send()
} }
@ -92,7 +92,7 @@ async fn main() {
let generator = tokio::spawn(async { let generator = tokio::spawn(async {
let mut interval = time::interval(time::Duration::from_secs( let mut interval = time::interval(time::Duration::from_secs(
std::env::var("RULEBOT_POST_INTERVAL") std::env::var("RULEBOT_POST_INTERVAL")
.unwrap_or("2".into()) .unwrap_or("300".into())
.parse() .parse()
.unwrap(), .unwrap(),
)); ));

Loading…
Cancel
Save