Skip to content

Commit 60a8f2c

Browse files
authored
Merge pull request #149 from blairconrad/build-man-page
Build man page as part of workflows
2 parents 88b31e4 + cbc8c52 commit 60a8f2c

File tree

8 files changed

+72
-230
lines changed

8 files changed

+72
-230
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,21 @@ jobs:
3131
- uses: actions/checkout@v4
3232
- name: Check format
3333
run: cargo fmt --check
34+
35+
build-man-page:
36+
name: build-man-page
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: Setup environment
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get --assume-yes --no-install-recommends install asciidoc
44+
- name: Build from asciidoc
45+
working-directory: ./Documentation
46+
run: make
47+
- name: Upload man page as artifact
48+
uses: actions/upload-artifact@v4
49+
with:
50+
path: Documentation/git-absorb.1
51+
name: git-absorb.1

.github/workflows/release.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,39 @@ jobs:
5252
tag_name: ${{ env.GA_VERSION }}
5353
release_name: ${{ env.GA_VERSION }}
5454

55+
build-man-page:
56+
name: build-man-page
57+
needs: ['create-release']
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Setup environment
62+
run: |
63+
sudo apt-get update
64+
sudo apt-get --assume-yes --no-install-recommends install asciidoc
65+
- name: Build from asciidoc
66+
env:
67+
GA_VERSION: ${{ needs.create-release.outputs.GA_VERSION }}
68+
working-directory: ./Documentation
69+
run: make
70+
- name: Upload man page as artifact
71+
uses: actions/upload-artifact@v4
72+
with:
73+
path: Documentation/git-absorb.1
74+
name: git-absorb.1
75+
- name: Attach man page to release
76+
uses: actions/upload-release-asset@v1.0.1
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
with:
80+
upload_url: ${{ needs.create-release.outputs.upload_url }}
81+
asset_path: Documentation/git-absorb.1
82+
asset_name: git-absorb.1
83+
asset_content_type: application/octet-stream
84+
5585
build-release:
5686
name: build-release
57-
needs: ['create-release']
87+
needs: ['create-release', 'build-man-page']
5888
runs-on: ${{ matrix.os }}
5989
env:
6090
# Emit backtraces on panics.
@@ -122,6 +152,12 @@ jobs:
122152
arm-linux-gnueabihf-strip \
123153
/target/arm-unknown-linux-gnueabihf/release/git-absorb
124154
155+
- name: Download man page
156+
uses: actions/download-artifact@v4
157+
with:
158+
name: git-absorb.1
159+
path: Documentation
160+
125161
- name: Build archive
126162
shell: bash
127163
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/Documentation/git-absorb.1
12
/target/
23
.idea

Documentation/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ build-manpage: git-absorb.1
33
git-absorb.1: git-absorb.txt
44
$(if $(shell which a2x),,$(error "No a2x in PATH; install asciidoc."))
55
$(info Building manpage. This may take a few moments...)
6-
a2x -L -d manpage -f manpage git-absorb.txt
6+
a2x -L -d manpage -f manpage git-absorb.txt --attribute man-version=${GA_VERSION}
77

88
clean:
99
rm -f git-absorb.1 git-absorb.xml

Documentation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
git-absorb manual
22
=================
33

4-
This project's man page `git-absorb.1.gz` can be generated from `git-absorb.txt`
4+
This project's man page `git-absorb.1` can be generated from `git-absorb.txt`
55
by running `make`.
66

77
Build dependencies

Documentation/git-absorb.1

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

Documentation/git-absorb.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
:man source: git-absorb
2-
:man version: 0.5.0
2+
:man version: {man-version}
33
:man manual: git absorb
44

55
git-absorb(1)

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,20 @@ Then `cargo install git-absorb`. Make sure that `$CARGO_HOME/bin` is on your `$P
6363

6464
Note that `git absorb` does _not_ use the system libgit2. This means you do not need to have libgit2 installed to build or run it. However, this does mean you have to be able to build libgit2. (Due to [recent changes](https://github.com/alexcrichton/git2-rs/commit/76f4b74aef2bc2a54906ddcbf7fbe0018936a69d) in the git2 crate, CMake is no longer needed to build it.)
6565

66-
Note: `cargo install` does not currently know how to install manpages ([cargo#2729](https://github.com/rust-lang/cargo/issues/2729)), so if you use `cargo` for installation then `git absorb --help` will not work. Here is a manual workaround, assuming your system has a `~/.local/share/man/man1` directory that `man --path` knows about:
66+
Note: `cargo install` does not currently know how to install manpages ([cargo#2729](https://github.com/rust-lang/cargo/issues/2729)), so if you use `cargo` for installation then `git absorb --help` will not work. There are two manual workarounds, assuming your system has a `~/.local/share/man/man1` directory that `man --path` knows about:
67+
68+
1. build the man page from source and copy
69+
This requires that the [a2x](https://asciidoc-py.github.io/a2x.1.html) tool be installed on your system.
70+
```bash
71+
cd ./Documentation
72+
make
73+
mv git-absorb.1 ~/.local/share/man/man1
74+
```
75+
2. download a recently-built man page
76+
1. find a recent build as in [Installing](#installing) above
77+
2. download the `git-absorb.1` file and unzip
78+
3. move it to `~/.local/share/man/man1`
6779

68-
```
69-
wget https://raw.githubusercontent.com/tummychow/git-absorb/master/Documentation/git-absorb.1
70-
mv git-absorb.1 ~/.local/share/man/man1
71-
```
7280

7381
## Usage
7482

0 commit comments

Comments
 (0)