Skip to content

Commit fcd967e

Browse files
committed
Адноўлены службовыя файлы
1 parent bf45961 commit fcd967e

14 files changed

Lines changed: 184 additions & 159 deletions

File tree

.github/workflows/pr-build.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v3
1212

13-
- name: Download bootstrap file
14-
run: wget https://raw.githubusercontent.com/progit/progit2-pub/master/bootstrap.sh
15-
- name: Run bootstrap
16-
run: sh bootstrap.sh
17-
- name: Set up Ruby
18-
uses: ruby/setup-ruby@v1
19-
with:
20-
ruby-version: 2.7
21-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
13+
- name: Set up Ruby
14+
uses: ruby/setup-ruby@v1
15+
with:
16+
ruby-version: 2.7
17+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
2218

23-
- name: Build book
24-
run: bundle exec rake book:build_action
19+
- name: Build Book
20+
run: bundle exec rake book:build
Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,41 @@
1-
name: Release on push to main
1+
name: Release from master
22

33
on:
44
push:
5-
branches: [ main, master ]
5+
branches: [ master ]
6+
7+
workflow_dispatch:
68

79
jobs:
810
release:
911
runs-on: ubuntu-latest
1012
steps:
11-
- uses: actions/checkout@v2
12-
with:
13-
fetch-depth: 0
14-
- name: get bootstrap file
15-
run: wget https://raw.githubusercontent.com/progit/progit2-pub/master/bootstrap.sh
16-
- name: run bootstrap
17-
run: sh bootstrap.sh
18-
- name: Compute tag name
19-
id: compute-tag
20-
run: |
21-
echo Computing next tag number
22-
LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3)
23-
PATCH=$(($LASTPATCH+1))
24-
echo "::set-output name=tagname::2.1.${PATCH}"
25-
echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Compute tag name
18+
id: compute-tag
19+
run: |
20+
echo "Computing next tag number"
21+
LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3)
22+
PATCH=$(($LASTPATCH+1))
23+
echo "New tag name: 2.1.${PATCH}"
24+
echo "::set-output name=tagname::2.1.${PATCH}"
2625
27-
- name: Set up Ruby
28-
uses: ruby/setup-ruby@v1
29-
with:
30-
ruby-version: 2.7
31-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
26+
- name: Set up Ruby
27+
uses: ruby/setup-ruby@v1
28+
with:
29+
ruby-version: 2.7
30+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
3231

33-
- name: Build release assets
34-
run: bundle exec rake book:build_action
32+
- name: Build release assets
33+
run: bundle exec rake book:build
3534

36-
- name: Create release
37-
uses: ncipollo/release-action@v1
38-
with:
39-
token: ${{ secrets.GITHUB_TOKEN }}
40-
tag: ${{ steps.compute-tag.outputs.tagname }}
41-
commit: ${{ steps.compute-tag.outputs.branch }}
42-
artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html'
35+
- name: Create Release
36+
uses: ncipollo/release-action@v1
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
tag: ${{ steps.compute-tag.outputs.tagname }}
40+
commit: master
41+
artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
output
22
.DS_Store
3+
.vscode
4+
.bundle
35

46
# build artifacts
57
Gemfile.lock

.travis.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

Gemfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
source 'https://rubygems.org'
22

3-
gem 'rake', '13.0.3'
4-
gem 'asciidoctor', '2.0.12'
3+
gem 'rake', '13.0.6'
4+
gem 'asciidoctor', '2.0.17'
55

6-
gem 'json', '2.5.1'
6+
gem 'json', '2.6.2'
77
gem 'awesome_print', '1.9.2'
88

9-
gem 'asciidoctor-epub3', '1.5.0.alpha.19'
10-
gem 'asciidoctor-pdf', '1.5.4'
9+
gem 'asciidoctor-epub3', '1.5.1'
10+
gem 'asciidoctor-pdf', '2.0.8'
1111

1212
gem 'coderay', '1.1.3'
13-
gem 'pygments.rb', '2.2.0'
13+
gem 'pygments.rb', '2.3.0'
1414
gem 'thread_safe', '0.3.6'
15-
gem 'epubcheck-ruby', '4.2.4.0'
16-
gem 'html-proofer', '3.18.8'
15+
gem 'epubcheck-ruby', '4.2.6.0'
16+
gem 'html-proofer', '3.19.4'

LICENSE.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Гэты твор распаўсюджваецца па вольнай ліцэнзіі Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
2-
Азнаёміцца з тэкстам ліцэнзіі вы можаце на сайце https://creativecommons.org/licenses/by-nc-sa/3.0/deed.be або па пошце, даслаўшы ліст у арганізацыю Creative Commons па адрасе: PO Box 1866, Mountain View, CA 94042, USA.
2+
Азнаёміцца з тэкстам ліцэнзіі вы можаце на сайце https://creativecommons.org/licenses/by-nc-sa/3.0/deed.be або па пошце, даслаўшы ліст у арганізацыю Creative Commons па адрасе: PO Box 1866, Mountain View, CA 94042, USA.

README.asc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
Ёсць два сбосабу атрымаць файл электроннай кнігі з гэтага коду.
2424
2525
Самы просты -- даручыць гэта нам.
26-
Робат рэагуе на змены ў ветцы `master` рэпазітара и аутаматычна збірае книгу ва ўсіх фарматах.
26+
Робат рэагуе на змены ў ветцы `master` рэпазітара и аутаматычна збірае кнігу ва ўсіх фарматах.
2727
28-
Апошнюю зборку сожна знайсці на старонцы https://git-scm.com/book/ru/v2.
28+
Апошнюю зборку можна знайсці на старонцы https://git-scm.com/book/be/v2.
2929
3030
Іншы спосаб атрымаць кнігу -- сабраць яе самастойна з дапамогай Asciidoctor.
3131
Выкарыстоўваючы каманды ніжэй, вы зможаце атрымаць кнігу ў фарматах HTML, EPUB і PDF.
@@ -63,13 +63,13 @@ EPUBCheck completed
6363
Тут выкарыстоўваюцца праекты `asciidoctor`, `asciidoctor-pdf` и `asciidoctor-epub`.
6464
6565
Па змаўчанні, `bundle install` усталёўвае залежнасці глабальна у сістэму.
66-
Каб гэтага пазбегнуць, у прыкладзе вышэй менеджэр пакетаў дадаткова канфігуруецца перад усталяваннем залежнасцяў з дапамогай наступнай каманды:
66+
Каб гэтага пазбегнуць, у прыкладзе вышэй менеджэр пакетаў дадаткова канфігуруецца перад усталяваннем залежнасцяў з дапамогай наступнай каманды:
6767
6868
----
6969
bundle config set --local path '.bundle/vendor'
7070
----
7171
72-
Таксама існуе магчымасць сабраць кнігу толькі ў адным з фарматаў.
72+
Таксама існуе магчымасць сабраць кнігу толькі ў адным з фарматаў.
7373
7474
Для генерацыі толькі HTML файла:
7575

Rakefile

Lines changed: 112 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,133 @@
1+
require 'open-uri'
2+
13
namespace :book do
24
def exec_or_raise(command)
35
puts `#{command}`
46
if (! $?.success?)
5-
raise "'#{command}' failed"
7+
raise "[ERROR] '#{command}' failed"
68
end
79
end
810

9-
desc 'build basic book formats'
10-
task :build do
11+
def generate_contributors_list(column_size)
12+
# Generating preformatted contributors list...
13+
`git shortlog -s | grep -v -E "(Straub|Chacon|dependabot)" | cut -f 2- | column -c #{column_size} > book/contributors.txt`
14+
end
15+
16+
def download_locale(locale_file)
17+
locale_file_url = "https://raw.githubusercontent.com/asciidoctor/asciidoctor/master/data/locale/#{locale_file}"
18+
if not File.exist?(locale_file)
19+
puts "Downloading locale attributes file..."
20+
l10n_text = URI.open(locale_file_url).read
21+
File.open(locale_file, 'w') { |file| file.puts l10n_text }
22+
puts " -- Saved at #{locale_file}"
23+
else
24+
puts "Use existing file with locale attributes #{locale_file}"
25+
end
26+
end
27+
28+
# Variables referenced for build
29+
lang = 'be'
30+
locale_file = "attributes-#{lang}.adoc"
31+
date_string = Time.now.strftime('%d.%m.%Y')
32+
33+
version_string = `git describe --tags`.chomp
34+
if version_string.empty?
35+
version_string = '0'
36+
end
37+
params = "--attribute revnumber='#{version_string}' --attribute revdate='#{date_string}' --attribute lang=#{lang} "
38+
ignore_urls = "'https://developer.github.com','https://developer.github.com/webhooks/','https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent','https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit'"
1139

40+
# Tasks list
41+
desc 'build basic book formats'
42+
task :build => [:build_html, :build_epub, :build_mobi, :build_pdf] do
1243
begin
13-
lang = "be"
14-
begin
15-
locale_file = "attributes-#{lang}.adoc"
16-
if not File.exist?(locale_file)
17-
puts "Downloading locale attributes file #{lang_file} from asciidoc repo..."
18-
l10n_text = URI.open("https://raw.githubusercontent.com/asciidoctor/asciidoctor/master/data/locale/#{locale_file}").read
19-
File.open(locale_file, 'w') {|file| file.puts l10n_text}
20-
else
21-
puts "Use existing file with locale attributes #{locale_file}"
22-
end
23-
rescue
24-
puts "[ERROR] Can not download attributes list for language #{lang}"
25-
end
44+
puts 'Validating generated files...'
45+
Rake::Task['book:check'].invoke
46+
end
47+
end
2648

27-
version_string = ENV['TRAVIS_TAG'] || `git describe --tags`.chomp
28-
if version_string.empty?
29-
version_string = '0'
30-
end
31-
date_string = Time.now.strftime("%Y-%m-%d")
32-
params = "--attribute revnumber='#{version_string}' --attribute revdate='#{date_string}'"
33-
puts "Generating contributors list"
34-
`git shortlog -s | grep -v -E "(Straub|Chacon|dependabot)" | cut -f 2- | column -c 120 > book/contributors.txt`
49+
desc 'prepare necessary data to start build'
50+
task :prebuild, [:column_size] do |t, args|
51+
args.with_defaults(:column_size => 96)
52+
53+
download_locale(locale_file)
54+
generate_contributors_list(args.column_size)
55+
end
56+
57+
desc 'build HTML format'
58+
task :build_html do
59+
Rake::Task['book:prebuild'].invoke(96)
3560

36-
puts "Converting to HTML..."
37-
`bundle exec asciidoctor #{params} -a data-uri progit.asc`
38-
puts " -- HTML output at progit.html"
61+
puts 'Converting to HTML...'
62+
`bundle exec asciidoctor #{params} -a data-uri progit.asc`
63+
puts ' -- HTML output at progit.html'
64+
end
3965

40-
exec_or_raise('htmlproofer --check-html progit.html')
66+
desc 'build EPUB format'
67+
task :build_epub do
68+
Rake::Task['book:prebuild'].invoke(48)
4169

42-
puts "Converting to EPub..."
43-
`bundle exec asciidoctor-epub3 #{params} progit.asc`
44-
puts " -- Epub output at progit.epub"
70+
puts 'Converting to EPUB...'
71+
`bundle exec asciidoctor-epub3 #{params} progit.asc`
72+
puts ' -- EPUB output at progit.epub'
73+
end
4574

46-
exec_or_raise('epubcheck progit.epub')
75+
desc 'build Mobi format'
76+
task :build_mobi do
77+
Rake::Task['book:prebuild'].invoke(96)
4778

48-
# Commented out the .mobi file creation because the kindlegen dependency is not available.
49-
# For more information on this see: #1496.
50-
# This is a (hopefully) temporary fix until upstream asciidoctor-epub3 is fixed and we can offer .mobi files again.
79+
# Commented out the .mobi file creation because the KindleGen dependency is not available.
80+
#
81+
# FIXME: If asciidoctor-epub3 supports Mobi again, uncomment these lines below
82+
# puts 'Converting to Mobi (kf8)...'
83+
# `bundle exec asciidoctor-epub3 #{params} -a ebook-format=kf8 progit.asc`
84+
# puts ' -- Mobi output at progit.mobi'
5185

52-
# puts "Converting to Mobi (kf8)..."
53-
# `bundle exec asciidoctor-epub3 #{params} -a ebook-format=kf8 progit.asc`
54-
# puts " -- Mobi output at progit.mobi"
86+
puts "Converting to Mobi is not longer supported."
87+
puts "For more information see issue #1496 at https://github.com/progit/progit2/issues/1496."
88+
end
5589

56-
puts "Converting to PDF... (this one takes a while)"
57-
`bundle exec asciidoctor-pdf #{params} progit.asc 2>/dev/null`
58-
puts " -- PDF output at progit.pdf"
90+
desc 'build PDF format'
91+
task :build_pdf do
92+
Rake::Task['book:prebuild'].invoke(88)
93+
94+
puts 'Converting to PDF... (this one takes a while)'
95+
`bundle exec asciidoctor-pdf #{params} progit.asc 2>/dev/null`
96+
puts ' -- PDF output at progit.pdf'
97+
end
98+
99+
desc 'check HTML book'
100+
task :check_html do
101+
if not File.exist?('progit.html')
102+
Rake::Task['book:build_html'].invoke
103+
end
104+
105+
puts ' -- Validate HTML file progit.html'
106+
exec_or_raise("bundle exec htmlproofer --url-ignore #{ignore_urls} --check-html progit.html")
107+
end
59108

109+
desc 'check EPUB book'
110+
task :check_epub do
111+
if not File.exist?('progit.epub')
112+
Rake::Task['book:build_epub'].invoke
113+
end
114+
115+
puts ' -- Validate EPUB output file progit.epub'
116+
exec_or_raise('bundle exec epubcheck progit.epub')
117+
end
118+
119+
desc 'check generated books'
120+
task :check => [:check_html, :check_epub]
121+
122+
desc 'clean all generated files'
123+
task :clean do
124+
begin
125+
puts 'Removing downloaded and generated files'
126+
127+
FileList[locale_file, 'book/contributors.txt', 'progit.html', 'progit.epub', 'progit.pdf', 'progit.mobi'].each do |file|
128+
rm file
129+
rescue Errno::ENOENT
130+
end
60131
end
61132
end
62133
end

book/04-git-server/sections/generating-ssh-key.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx
5454
NrRFi9wrf+M7Q== schacon@mylaptop.local
5555
----
5656

57-
For a more in-depth tutorial on creating an SSH key on multiple operating systems, see the GitHub guide on SSH keys at https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent[].
57+
Больш падрабязнае кіраўніцтва (на ангельскай мове) па стварэнню SSH-ключоў і канфігурацыі кліента ў розных сістэмах вы можаце знайсці ў https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent[кіраўніцтве GitHub].

book/index.asc

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)