mirror of
https://github.com/SchildiChat/schildichat-desktop.git
synced 2025-03-28 11:02:00 +01:00
[WIP] Deploy scripts
This commit is contained in:
parent
f0b142e996
commit
651ffc13df
1
deploy/.gitignore
vendored
Normal file
1
deploy/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
repos/*
|
33
deploy/update_aur-bin.sh
Executable file
33
deploy/update_aur-bin.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
DEPLOY_ROOT="$(dirname "$(realpath "$0")")"
|
||||
|
||||
version="$1"
|
||||
debpath="$2"
|
||||
|
||||
repopath="$DEPLOY_ROOT/repos/aur-bin"
|
||||
repourl="ssh://aur@aur.archlinux.org/schildichat-desktop-bin.git"
|
||||
|
||||
sha256sum=($(sha256sum $debpath))
|
||||
|
||||
[ -d "$repopath" ] || git clone $repourl $repopath
|
||||
|
||||
pushd "$repopath" > /dev/null
|
||||
|
||||
git fetch
|
||||
git reset --hard origin/master
|
||||
|
||||
sed -i "s|^pkgver=.*$|pkgver=$version|" PKGBUILD
|
||||
sed -i "s|^sha256sums=('.*'$|sha256sums=('$sha256sum'|" PKGBUILD
|
||||
|
||||
makepkg --printsrcinfo > .SRCINFO
|
||||
|
||||
git add .SRCINFO PKGBUILD
|
||||
git commit -m "Bump version to v$version"
|
||||
|
||||
#git push
|
||||
|
||||
popd > /dev/null
|
44
deploy/update_flathub.sh
Executable file
44
deploy/update_flathub.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
DEPLOY_ROOT="$(dirname "$(realpath "$0")")"
|
||||
|
||||
version="$1"
|
||||
debpath="$2"
|
||||
|
||||
repopath="$DEPLOY_ROOT/repos/flathub"
|
||||
repourl="git@github.com:flathub/chat.schildi.desktop.git"
|
||||
|
||||
downloadurl="https://github.com/SchildiChat/schildichat-desktop/releases/download/v${version}/schildichat-desktop_${version}_amd64.deb"
|
||||
sha256sum=($(sha256sum $debpath))
|
||||
debsize=($(wc -c $debpath))
|
||||
debdate=$(date +%Y-%m-%d -r $debpath)
|
||||
|
||||
[ -d "$repopath" ] || git clone $repourl $repopath
|
||||
|
||||
pushd "$repopath" > /dev/null
|
||||
|
||||
git fetch
|
||||
git reset --hard origin/master
|
||||
|
||||
jsonFile="chat.schildi.desktop.json"
|
||||
jsonString=$(jq -r "." $jsonFile)
|
||||
|
||||
xmlFile="chat.schildi.desktop.appdata.xml"
|
||||
|
||||
jsonString=$(echo $jsonString | jq -r ".modules[]? |= ((select(.name?==\"schildichat\") | .sources[0].url = \"${downloadurl}\") // .)")
|
||||
jsonString=$(echo $jsonString | jq -r ".modules[]? |= ((select(.name?==\"schildichat\") | .sources[0].sha256 = \"${sha256sum}\") // .)")
|
||||
jsonString=$(echo $jsonString | jq -r ".modules[]? |= ((select(.name?==\"schildichat\") | .sources[0].size = ${debsize}) // .)")
|
||||
|
||||
echo $jsonString | jq --indent 4 "." > $jsonFile
|
||||
|
||||
sed -i "s|^\s\s<releases>$| <releases>\n <release version=\"$version\" date=\"$debdate\"/>'|" $xmlFile
|
||||
|
||||
git add $jsonFile $xmlFile
|
||||
git commit -m "Bump version to v$version"
|
||||
|
||||
#git push
|
||||
|
||||
popd > /dev/null
|
64
deploy/upload-github-release-asset.sh
Executable file
64
deploy/upload-github-release-asset.sh
Executable file
@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Author: Stefan Buck
|
||||
# License: MIT
|
||||
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
|
||||
#
|
||||
#
|
||||
# This script accepts the following parameters:
|
||||
#
|
||||
# * owner
|
||||
# * repo
|
||||
# * tag
|
||||
# * filename
|
||||
# * github_api_token
|
||||
#
|
||||
# Script to upload a release asset using the GitHub API v3.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# upload-github-release-asset.sh github_api_token=TOKEN owner=stefanbuck repo=playground tag=v0.1.0 filename=./build.zip
|
||||
#
|
||||
|
||||
# Check dependencies.
|
||||
set -e
|
||||
xargs=$(which gxargs || which xargs)
|
||||
|
||||
# Validate settings.
|
||||
[ "$TRACE" ] && set -x
|
||||
|
||||
CONFIG=$@
|
||||
|
||||
for line in $CONFIG; do
|
||||
eval "$line"
|
||||
done
|
||||
|
||||
# Define variables.
|
||||
GH_API="https://api.github.com"
|
||||
GH_REPO="$GH_API/repos/$owner/$repo"
|
||||
GH_TAGS="$GH_REPO/releases/tags/$tag"
|
||||
AUTH="Authorization: token $github_api_token"
|
||||
WGET_ARGS="--content-disposition --auth-no-challenge --no-cookie"
|
||||
CURL_ARGS="-LJO#"
|
||||
|
||||
if [[ "$tag" == 'LATEST' ]]; then
|
||||
GH_TAGS="$GH_REPO/releases/latest"
|
||||
fi
|
||||
|
||||
# Validate token.
|
||||
curl -o /dev/null -sH "$AUTH" $GH_REPO || { echo "Error: Invalid repo, token or network issue!"; exit 1; }
|
||||
|
||||
# Read asset tags.
|
||||
response=$(curl -sH "$AUTH" $GH_TAGS)
|
||||
|
||||
# Get ID of the asset based on given filename.
|
||||
eval $(echo "$response" | grep -m 1 "id.:" | grep -w id | tr : = | tr -cd '[[:alnum:]]=')
|
||||
[ "$id" ] || { echo "Error: Failed to get release id for tag: $tag"; echo "$response" | awk 'length($0)<100' >&2; exit 1; }
|
||||
|
||||
# Upload asset
|
||||
echo "Uploading asset... "
|
||||
|
||||
# Construct url
|
||||
GH_ASSET="https://uploads.github.com/repos/$owner/$repo/releases/$id/assets?name=$(basename $filename)"
|
||||
|
||||
curl "$GITHUB_OAUTH_BASIC" --data-binary @"$filename" -H "Authorization: token $github_api_token" -H "Content-Type: application/octet-stream" $GH_ASSET
|
14
deploy/upload_github.sh
Executable file
14
deploy/upload_github.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
DEPLOY_ROOT="$(dirname "$(realpath "$0")")"
|
||||
|
||||
version="$1"
|
||||
releasepath="$2"
|
||||
|
||||
find "$releasepath" -type f | while read p; do
|
||||
echo "Uploading $p ..."
|
||||
$DEPLOY_ROOT/upload-github-release-asset.sh github_api_token=$GITHUB_TOKEN owner=SchildiChat repo=schildichat-desktop tag=v$version filename=$p
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user