From 025e710d44e0720a5e4f094f0448563e5f59ee3c Mon Sep 17 00:00:00 2001 From: HeNine <> Date: Wed, 19 Apr 2023 16:05:49 +0200 Subject: [PATCH] mvp? --- .gitea/workflows/build_docker.yaml | 34 --------------------------- .gitea/workflows/publish_package.yaml | 28 +++++++++++++++++++++- Cargo.lock | 2 +- Cargo.toml | 4 ++-- docker-compose.yaml | 10 ++++++++ src/main.rs | 4 ++-- 6 files changed, 42 insertions(+), 40 deletions(-) delete mode 100644 .gitea/workflows/build_docker.yaml create mode 100644 docker-compose.yaml diff --git a/.gitea/workflows/build_docker.yaml b/.gitea/workflows/build_docker.yaml deleted file mode 100644 index e917f5c..0000000 --- a/.gitea/workflows/build_docker.yaml +++ /dev/null @@ -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 diff --git a/.gitea/workflows/publish_package.yaml b/.gitea/workflows/publish_package.yaml index 5ec7698..c6fc93a 100644 --- a/.gitea/workflows/publish_package.yaml +++ b/.gitea/workflows/publish_package.yaml @@ -26,7 +26,7 @@ jobs: uses: https://github.com/actions-rs/cargo@v1 with: 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: runs-on: ubuntu-latest @@ -35,5 +35,31 @@ jobs: - name: Check out repository code 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 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 }} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index e2ae16a..517bc0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -720,7 +720,7 @@ dependencies = [ [[package]] name = "rulebot" -version = "0.1.0" +version = "0.2.0" dependencies = [ "env_logger", "exitcode", diff --git a/Cargo.toml b/Cargo.toml index 3ef2bac..e7f189c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "rulebot" -version = "0.1.0" +version = "0.2.0" edition = "2021" description = "Bot for Mastodon that runs a random cellular automaton on an 8-bit input." readme = "README.md" homepage = "https://mastodon.raptorpond.com/@rulebot" repository = "https://git.raptorpond.com/henine/rulebot" license = "MIT" -exclude = ["/.*"] +exclude = ["/.*", "logo.png"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ad4e26f --- /dev/null +++ b/docker-compose.yaml @@ -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" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 1d28eb5..9432a7c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,7 +65,7 @@ async fn send_status( ) .form(&[ ("status", format!("Rule: {}\n{}", rule, states)), - ("visibility", String::from("private")), + ("visibility", String::from("public")), ]) .send() } @@ -92,7 +92,7 @@ async fn main() { let generator = tokio::spawn(async { let mut interval = time::interval(time::Duration::from_secs( std::env::var("RULEBOT_POST_INTERVAL") - .unwrap_or("2".into()) + .unwrap_or("300".into()) .parse() .unwrap(), ));