Skip to content

Commit

Permalink
chore: switch to asciidoctor
Browse files Browse the repository at this point in the history
  • Loading branch information
pskrwe committed Feb 6, 2024
1 parent ded79e7 commit 8f71d5c
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 52 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ jobs:
- name: Setup Syft
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin

- name: Install ronn
run: sudo apt-get update && sudo apt-get install -y ronn
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- run: gem install asciidoctor

- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
Expand All @@ -51,7 +54,6 @@ jobs:
run: |
gotestsum --format pkgname -- -covermode=atomic ./...
# run release only on linux
- name: Release
uses: goreleaser/goreleaser-action@v5
with:
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
Expand All @@ -29,15 +27,8 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
# Semantic version range syntax or exact version of Go
go-version: ${{ matrix.go-version }}

- name: Setup Syft
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin

- name: Install ronn
run: sudo apt-get update && sudo apt-get install -y ronn

- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest

Expand All @@ -53,8 +44,23 @@ jobs:
run: |
gotestsum --format pkgname -- -covermode=atomic ./...
# Do not run release on windows
- uses: ruby/setup-ruby@v1
if: ${{ !contains(matrix.os, 'windows') }}
with:
ruby-version: '3.3'
bundler-cache: true

- run: gem install asciidoctor
if: ${{ !contains(matrix.os, 'windows') }}

- name: Setup Syft
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
if: ${{ !contains(matrix.os, 'windows') }}

- name: Snapshot release
uses: goreleaser/goreleaser-action@v5
if: ${{ !contains(matrix.os, 'windows') }}
with:
distribution: goreleaser
version: latest
Expand Down
15 changes: 9 additions & 6 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ version: 1
before:
hooks:
- go mod tidy -go=1.21
- ronn docs/git-age.md
- rm -f docs/git-age.1.gz
- gzip docs/git-age.1
- mkdir -p out/man
- mkdir -p out/html
- asciidoctor -a reproducible -b manpage -o out/man/git-age.1 docs/git-age.adoc
- gzip out/man/git-age.1
- asciidoctor -a reproducible -b html5 -o out/html/git-age.html docs/git-age.adoc

builds:
- env:
Expand Down Expand Up @@ -36,7 +38,8 @@ archives:
- goos: windows
format: zip
files:
- docs/git-age.1.gz
- src: out/man/git-age.1.gz
dst: docs/git-age.1.gz

sboms:
- artifacts: binary
Expand All @@ -63,7 +66,7 @@ nfpms:
dependencies:
- git
contents:
- src: docs/git-age.1.gz
- src: out/man/git-age.1.gz
dst: /usr/share/man/man1/git-age.1.gz
- src: LICENSE
dst: /usr/share/licenses/git-age/LICENSE
Expand Down Expand Up @@ -119,7 +122,7 @@ winget:
owner: prskr
name: winget-pkgs
branch: "git-age-{{.Version}}"
token: "{{ .Env.GH_WINGET_PAT_TOKEN }}"
token: "{{ .Env.GH_WINGET_PAT }}"
pull_request:
enabled: true
draft: true
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ By default `git-age` will store the private keys in `$XDG_CONFIG_HOME/git-age/ke
- [`husky`](https://github.com/go-courier/husky)
- `goimports`
- `gofumpt`
- `asciidoctor`
- *optionally*: [`goreleaser`](https://goreleaser.com/)
- *optionally*: [`dlv`](https://github.com/go-delve/delve)

Expand Down
71 changes: 37 additions & 34 deletions docs/git-age.md → docs/git-age.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
git-age(1) -- protect secrets required for development in your repository
=========================================================================
= git-age(1)

## DESCRIPTION
== NAME

git-age - Protect secrets required for development in your repository

== DESCRIPTION

`git-age` is a smudge/clean filter for git that encrypts and decrypts files in your repository.
It is designed to be used in a team environment where you want to protect secrets required for development, such as API
Expand All @@ -10,62 +13,62 @@ keys, passwords, etc.
It is based on the great tool age(1) by Filippo Valsorda.
Every file encrypted by `git-age` is a valid age(1) file, and can be decrypted using the age(1) tool.

## SUBCOMMANDS
== SUBCOMMANDS

### git age install
=== git age install

Install the git-age hooks in global git configuration.

### git age init
=== git age init

`git age init` [`--comment` <COMMENT>, `--keys` <KEYS_TXT>]
`git age init` [`--comment` <COMMENT>, `--keys` <KEYS_TXT>]

Initialize the current repository for git-age.
This will:

1. create a `.agerecipients` file in the root of the repository
2. bootstrap a new keypair for the current user
3. add the public key to the `.agerecipients` file, optionally with a comment
4. add the private key to the keys file, optionally with a comment
. create a `.agerecipients` file in the root of the repository
. bootstrap a new keypair for the current user
. add the public key to the `.agerecipients` file, optionally with a comment
. add the private key to the keys file, optionally with a comment

### git age gen-key
=== git age gen-key

`git age gen-key` [`--comment` &lt;COMMENT&gt; `--keys` &lt;KEYS_TXT&gt;]
`git age gen-key` [`--comment` <COMMENT> `--keys` <KEYS_TXT>]

To quickly prepare your environment to participate at a project that already uses *git-age*, you can use the `gen-key`
To quickly prepare your environment to participate at a project that already uses _git-age_, you can use the `gen-key`
command to:

1. generate a new keypair for the current user
2. add the private key to the keys file, optionally with a comment
3. print the public key for sharing with a developer that already has access
. generate a new keypair for the current user
. add the private key to the keys file, optionally with a comment
. print the public key for sharing with a developer that already has access

The keys file can either be specified as flag or be read from the environment variable `GIT_AGE_KEYS`.

### git age add-recipient
=== git age add-recipient

`git age add-recipient` [`--comment` &lt;COMMENT&gt; `--keys` &lt;KEYS_TXT&gt; `--message` &lt;COMMIT_MESSAGE&gt;]
&lt;PUBLIC_KEY&gt;<br>
`git age add-recipient` [`--comment` <COMMENT> `--keys` <KEYS_TXT> `--message` <COMMIT_MESSAGE>]
<PUBLIC_KEY> +

### git age files
=== git age files

`files` is the main command to manage the files that should be encrypted and decrypted by `git-age`.

### git age files list
=== git age files list

`git age files list`

Lists all files that are/will be tracked by `git-age`.
This allows to verify that the files that should be encrypted are actually tracked.

### git age files track
=== git age files track

`git age files track` &lt;PATTERN&gt;
`git age files track` <PATTERN>

Add a file pattern to the `.gitattributes` file to track the file with `git-age`.
`git-age` will either append the pattern to the already present `.gitattributes` file in the **current** directory or
`git-age` will either append the pattern to the already present `.gitattributes` file in the *current* directory or
create a new `.gitattributes` file if it does not exist.

### git age files re-encrypt
=== git age files re-encrypt

`git age files re-encrypt`

Expand All @@ -74,28 +77,28 @@ This is useful if you want to change the recipients of the files e.g. if a devel
It can also be used to onboard a new developer to the team but it's recommended to use `git age add-recipient` for that
as it is specifically designed for this use case.

### git age version
=== git age version

`git age version`

Prints the version of the `git-age` tool.

### git age version check-update
=== git age version check-update

`git age version check-update`

Checks if there is a new version of the `git-age` tool available.

## EXAMPLES
== EXAMPLES

### Initialize a new repository
=== Initialize a new repository

git age init --comment "Alice"

### Add a new recipient
=== Add a new recipient

Bob:<br/>
Bob: +
git age gen-key --comment "Bob" > bob.pub

Alice: <br/>
git age add-recipient --comment "Bob" $(cat bob.pub)
Alice: +
git age add-recipient --comment "Bob" $(cat bob.pub)

0 comments on commit 8f71d5c

Please sign in to comment.