From 6ed9ad3569626d108525d11c65b33012d1a33c8f Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Wed, 24 Jan 2024 22:01:25 +0100 Subject: [PATCH] reade for release --- Cargo.toml | 1 - scripts/make_cert.sh | 5 ----- scripts/publish.sh | 11 +++++++++++ scripts/release.sh | 24 ++++++++++++++++++++++++ spammer/Cargo.toml | 9 --------- spammer/src/main.rs | 18 ------------------ 6 files changed, 35 insertions(+), 33 deletions(-) delete mode 100755 scripts/make_cert.sh create mode 100755 scripts/publish.sh create mode 100755 scripts/release.sh delete mode 100644 spammer/Cargo.toml delete mode 100644 spammer/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index cc13494..8e6ee59 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,3 @@ -workspace = { members = ["spammer"] } [package] name = "netpong" version = "0.2.1" diff --git a/scripts/make_cert.sh b/scripts/make_cert.sh deleted file mode 100755 index 2dd0782..0000000 --- a/scripts/make_cert.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -mkdir data -echo create ca -# non-interactive and 10 years expiration -openssl req -x509 -nodes -newkey rsa:4096 -keyout data/key.pem -out data/cert.pem -sha256 -days 3650 -subj '/CN=localhost' diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100755 index 0000000..4a3d17d --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e +cargo check --all-features +echo ">>>>>>>> PUBLISHING RELEASE FOR REPO" +bash scripts/release.sh +echo ">>>>>>>> PUBLISHING TO CRATES.IO NEXT" +sleep 2 +cargo publish +echo ">>>>>>>> PUBLISHING TO CSCHERR.DE NEXT" +sleep 2 +cargo publish --registry cscherr diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..943ad51 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,24 @@ +#!/bin/bash +TOKEN=$(cat ~/.git-credentials | grep 'git.cscherr.de' | grep -P '(?:)[^:]*(?=@)' -o) +NEW_VERSION=$(cat Cargo.toml | rg '^\s*version\s*=\s*"([^"]*)"\s*$' -or '$1') +GIT_COMMIT_SHA=$(git rev-parse HEAD) +REPO=${PWD##*/} # name of cwd +BODY=" +$(git log $(git describe --tags --abbrev=0)..HEAD --pretty="- %s" --oneline --decorate) +" +USER=PlexSheep +git tag "v$NEW_VERSION-test" || echo "could not tag" +curl -X 'POST' \ + 'https://git.cscherr.de/api/v1/repos/PlexSheep/'$REPO'/releases' \ + -H 'accept: application/json' \ + -H "Authorization: token $TOKEN" \ + -H 'Content-Type: application/json' \ + -d '{ + "body": "'"$BODY"'", + "draft": false, + "name": "v'$NEW_VERSION'", + "prerelease": true, + "tag_name": "v'$NEW_VERSION'", + "target_commitish": "'$GIT_COMMIT_SHA'" +}' | python -m json.tool +git push || echo "could not push" diff --git a/spammer/Cargo.toml b/spammer/Cargo.toml deleted file mode 100644 index ed89719..0000000 --- a/spammer/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "spammer" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -threadpool = "1.8.1" diff --git a/spammer/src/main.rs b/spammer/src/main.rs deleted file mode 100644 index a95f16e..0000000 --- a/spammer/src/main.rs +++ /dev/null @@ -1,18 +0,0 @@ -use threadpool::ThreadPool; -const MAX: usize = 20; -use std::process::Command; - -fn main() { - let pool = ThreadPool::new(MAX); - - loop { - if pool.queued_count() < MAX { - pool.execute(|| { - let mut cmd = Command::new("/usr/bin/python3"); - cmd.args(["../scripts/client.py"]); - let _ = cmd.output().unwrap(); - }); - } - std::thread::sleep(std::time::Duration::from_millis(100)); - } -}