Support repository path in commits

This commit is contained in:
2023-08-15 10:33:19 +02:00
parent 5a9e87cd5f
commit 6b15ccd0f5
11 changed files with 148 additions and 48 deletions

View File

@ -134,24 +134,9 @@ def write_info(package, downloads:)
end
def update_slackbuild_version(package_path, version)
raise TypeError, %(expected a version string, got "#{version}") unless version.is_a?(String)
name = package_path.split('/').last
slackbuild_filename = "slackbuilds/#{package_path}/#{name}.SlackBuild"
slackbuild_contents = File.read(slackbuild_filename)
.gsub(/^VERSION=\${VERSION:-.+/, "VERSION=${VERSION:-#{version}}")
File.open(slackbuild_filename, 'w') { |file| file.puts slackbuild_contents }
sh './bin/slackbuilder', 'slackbuild', package_path, version
end
def commit(package_path, version)
message = "#{package_path}: Updated for version #{version}"
unless system('git', '-C', 'slackbuilds', 'checkout', CONFIG[:branch],
err: '/dev/null')
sh 'git', '-C', 'slackbuilds', 'checkout', '-b', CONFIG[:branch], 'master'
end
sh 'git', '-C', 'slackbuilds', 'add', package_path
sh 'git', '-C', 'slackbuilds', 'commit', '-S', '-m', message
# sh 'git', '-C', 'slackbuilds', 'push', 'origin', CONFIG[:branch]
sh './bin/slackbuilder', 'commit', package_path, version
end

View File

@ -22,20 +22,6 @@ module SlackBuilder
# Reads the list fo tags from the GitHub API.
class GitHub < Repository
GITHUB_QUERY = <<~GQL
query ($name: String!, $owner: String!) {
repository(name: $name, owner: $owner) {
refs(last: 10, refPrefix: "refs/tags/", orderBy: { field: TAG_COMMIT_DATE, direction: ASC }) {
nodes {
id,
name
}
}
}
}
GQL
private_constant :GITHUB_QUERY
def initialize(owner, name, version_transform = nil)
super()