release script update

This commit is contained in:
ppom 2024-10-24 12:00:00 +02:00
commit d776667c80
2 changed files with 9 additions and 96 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ requests ])" -p debian-devscripts git minisign cargo-cross
import base64
import http.client
import json
import os
import subprocess
@ -32,13 +33,13 @@ def main():
sys.exit(1)
# Ask user
# if input(f"We will create a release for tag {tag}. Do you want to continue? (y/n) ") != "y":
# print("exiting.")
# sys.exit(1)
if input(f"We will create a release for tag {tag}. Do you want to continue? (y/n) ") != "y":
print("exiting.")
sys.exit(1)
# Git push
# cmd = subprocess.run(["git", "push", "--tags"])
# quit_if(cmd)
cmd = subprocess.run(["git", "push", "--tags"])
quit_if(cmd)
cmd = subprocess.run(["rbw", "get", "minisign"], capture_output=True, text=True)
quit_if(cmd)
@ -256,6 +257,7 @@ wget https://static.ppom.me/reaction/releases/{tag}/reaction_{tag}-1_amd64.deb \
print("User deleted emptied description, exiting.")
sys.exit(1)
# Construct JSON payload
files = [ file for file in all_files if file[2] != False ]
data = {
"tag_name": tag,
@ -263,7 +265,7 @@ wget https://static.ppom.me/reaction/releases/{tag}/reaction_{tag}-1_amd64.deb \
"assets": {
"links": [
{
"url": f"https://static.ppom.me/reaction/releases/{tag}/{file[1]}/{os.path.basename(file[0])}".replace("//", "/"),
"url": "https://" + f"static.ppom.me/reaction/releases/{tag}/{file[1]}/{os.path.basename(file[0])}".replace("//", "/"),
"name": file[2],
"link_type": file[3],
}
@ -275,16 +277,13 @@ wget https://static.ppom.me/reaction/releases/{tag}/reaction_{tag}-1_amd64.deb \
body = json.dumps(data)
subprocess.run(["jq"], text=True, input=body)
# Send POST request
headers = {
"Host": "framagit.org",
"Content-Type": "application/json",
"PRIVATE-TOKEN": token,
}
sys.exit(1)
conn = http.client.HTTPSConnection("framagit.org")
conn.request("POST", "/api/v4/projects/90566/releases", body=body, headers=headers)
response = conn.getresponse()

View file

@ -1,86 +0,0 @@
#!/usr/bin/env bash
set -exu
git push --tags
TAG="$(git tag --sort=v:refname | tail -n1)"
echo -n "We will create a release for tag $TAG. Do you want to continue? (y/n) "
docker run -it --rm \
-e HOME=/tmp/ \
-v "$(pwd)":/tmp/code -w /tmp/code \
-u "$(id -u)" \
rust \
make reaction_"${TAG:1}"-1_amd64.deb reaction ip46tables nft46
make "signatures_${TAG:1}"
rsync -avz -e 'ssh -J pica01' \
./ip46tables ./ip46tables.minisig \
./nft46 ./nft46.minisig \
./target/release/reaction ./reaction.minisig \
./reaction_"${TAG:1}"-1_amd64.deb ./reaction_"${TAG:1}"-1_amd64.deb.minisig \
./target/release/reaction.bash ./target/release/reaction.fish ./target/release/_reaction \
./target/release/reaction*.1
akesi:/var/www/static/reaction/releases/"$TAG"
TOKEN="$(rbw get framagit.org token)"
DESCRIPTION="
## Changes
## Download
\`\`\`bash
wget https://static.ppom.me/reaction/releases/""$TAG""/nft46 \\
https://static.ppom.me/reaction/releases/""$TAG""/reaction \\
https://static.ppom.me/reaction/releases/""$TAG""/ip46tables \\
https://static.ppom.me/reaction/releases/""$TAG""/nft46.minisig \\
https://static.ppom.me/reaction/releases/""$TAG""/reaction.minisig \\
https://static.ppom.me/reaction/releases/""$TAG""/ip46tables.minisig
for i in nft46 ip46tables reaction
do
minisign -VP RWSpLTPfbvllNqRrXUgZzM7mFjLUA7PQioAItz80ag8uU4A2wtoT2DzX -m $i && rm $i.minisig
done
\`\`\`
**Debian Installation**
\`\`\`bash
wget https://static.ppom.me/reaction/releases/""$TAG""/reaction_""${TAG:1}""-1_amd64.deb \\
https://static.ppom.me/reaction/releases/""$TAG""/reaction_""${TAG:1}""-1_amd64.deb.minisig
minisign -VP RWSpLTPfbvllNqRrXUgZzM7mFjLUA7PQioAItz80ag8uU4A2wtoT2DzX -m reaction_""${TAG:1}""-1_amd64.deb &&
rm reaction_""${TAG:1}""-1_amd64.deb.minisig &&
apt install ./reaction_""${TAG:1}""-1_amd64.deb
\`\`\`
"
DATA='{
"tag_name":"'"$TAG"'",
"description": "'"$DESCRIPTION"'",
"assets":{"links":[
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/nft46", "name": "nft46 (x86-64)", "link_type": "package"},
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/reaction", "name": "reaction (x86-64)", "link_type": "package"},
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/ip46tables", "name": "ip46tables (x86-64)", "link_type": "package"},
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/reaction_'"${TAG:1}"'-1_amd64.deb", "name": "reaction_'"${TAG:1}"'-1_amd64.deb (x86-64)", "link_type": "package"},
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/nft46.minisig", "name": "nft46.minisig", "link_type": "other"},
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/reaction.minisig", "name": "reaction.minisig", "link_type": "other"},
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/ip46tables.minisig", "name": "ip46tables.minisig", "link_type": "other"},
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/reaction_'"${TAG:1}"'-1_amd64.deb.minisig", "name": "reaction_'"${TAG:1}"'-1_amd64.deb.minisig", "link_type": "other"},
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/reaction.bash", "name": "bash shell completion", "link_type": "other"},
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/reaction.fish", "name": "fish shell completion", "link_type": "other"},
{"url": "https://static.ppom.me/reaction/releases/'"$TAG"'/_reaction", "name": "zsh shell completion", "link_type": "other"}
]}}'
curl \
--fail-with-body \
--location \
-X POST \
-H 'Content-Type: application/json' \
-H "PRIVATE-TOKEN: $TOKEN" \
'https://framagit.org/api/v4/projects/90566/releases' \
--data "$DATA"
make clean