1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/acropolis_ynh.git synced 2024-09-03 18:06:22 +02:00

Merge pull request #12 from weex/update-version

Add bump_version.rb from ecko_ynh and bump the version
This commit is contained in:
David Sterry 2021-12-03 13:52:11 -08:00 committed by GitHub
commit 91d26d6a98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 82 additions and 7 deletions

72
bump-version.rb Executable file
View file

@ -0,0 +1,72 @@
#!/usr/bin/env ruby
# [For package maintainers]
# Edit the conf/app.src files with the latest commit
#
# Usage:
# ./bump-version.rb
require 'digest'
require 'json'
require 'open-uri'
module Yunohost
class AppSrcFile
def initialize(path = 'conf/app.src')
@path = path
end
def update(url, sum)
src = File.read(@path)
replace_src_setting!(src, 'SOURCE_URL', url)
replace_src_setting!(src, 'SOURCE_SUM', sum)
replace_src_setting!(src, 'SOURCE_FILENAME', File.basename(URI.parse(url).path))
File.write(@path, src)
end
private
def replace_src_setting!(str, setting, value)
str.gsub!(/^#{setting}=.*$/, "#{setting}=#{value}")
end
end
class ManifestFile
def initialize(path = 'manifest.json')
@path = path
end
def update_with_version(version)
manifest_file = File.read(@path)
manifest = JSON.parse(manifest_file)
if manifest['version'].start_with? version
i = manifest['version'].scan(/~ynh(\d)/).flatten.first.to_i + 1
manifest['version'] = "#{version}~ynh#{i}"
else
manifest['version'] = "#{version}~ynh1"
end
manifest_file = JSON.pretty_generate(manifest, indent: ' ') + "\n"
File.write(@path, manifest_file)
end
end
end
github = JSON.parse(URI.parse('https://api.github.com/repos/magicstone-dev/acropolis/branches/main').read)
last_commit = github["commit"]["sha"]
version = Date.parse(github["commit"]["commit"]["author"]["date"]).to_s
url = "https://github.com/magicstone-dev/acropolis/archive/#{last_commit}.tar.gz"
puts "Downloading last commit at #{url}"
release_file = URI.parse(url).read
sum = Digest::SHA256.hexdigest(release_file)
# Update source file
Yunohost::AppSrcFile.new().update(url, sum)
# Update manifest file
Yunohost::ManifestFile.new().update_with_version(version)
puts "Done!"

View file

@ -1,7 +1,7 @@
SOURCE_URL=https://github.com/magicstone-dev/acropolis/archive/refs/tags/v0.7.15.0.tar.gz
SOURCE_SUM=0cfc5f10ec8859280c95cb5db95846381621da0306cd4100f12691f18efa36be
SOURCE_URL=https://github.com/magicstone-dev/acropolis/archive/2b1c78ae680abcf42aa6a859139009defda61c1c.tar.gz
SOURCE_SUM=552c3564085fbb6acb8a330477bdda5ab43535969651b5076f92e4036499dcbf
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true
SOURCE_FILENAME=2b1c78ae680abcf42aa6a859139009defda61c1c.tar.gz
SOURCE_EXTRACT=true

View file

@ -6,7 +6,7 @@
"en": "Dynamic fork of diaspora*'s federated social network, est. Aug 2021.",
"fr": "Fourche dynamique du réseau social fédéré de diaspora*, créé en août 2021."
},
"version": "1.0~ynh1",
"version": "2021-12-02~ynh1",
"url": "https://github.com/magicstone-dev/acropolis",
"upstream": {
"license": "free",
@ -25,7 +25,7 @@
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -52,7 +52,10 @@
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr", "en"],
"choices": [
"fr",
"en"
],
"default": "fr"
},
{