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

Add bump-version script and dot-separated date-based version (#17)

* add bump_version.rb from ecko_ynh and bump the version
* change date-based version separator to dot
* Auto-update README

Co-authored-by: Yunohost-Bot <>
This commit is contained in:
David Sterry 2021-12-04 14:42:54 -08:00 committed by GitHub
parent 9f4d5ed113
commit a72a6e3b4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 84 additions and 9 deletions

View file

@ -26,7 +26,7 @@ Some long and extensive description of what the app is and does, lorem ipsum dol
- Excepteur sint occaecat cupidatat non proident, sunt in culpa."
**Shipped version:** 1.0~ynh1
**Shipped version:** 2021.12.02~ynh1

View file

@ -22,7 +22,7 @@ Some long and extensive description of what the app is and does, lorem ipsum dol
- Excepteur sint occaecat cupidatat non proident, sunt in culpa."
**Version incluse :** 1.0~ynh1
**Version incluse :** 2021.12.02~ynh1

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.gsub '-', '.'
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_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",
@ -52,7 +52,10 @@
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr", "en"],
"choices": [
"fr",
"en"
],
"default": "fr"
},
{