From 91ad1c138dafa2618ef997bb7982f4604cf9c23e Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Tue, 6 Feb 2024 21:02:26 +0100 Subject: [PATCH] chore: switch to asciidoctor --- .github/workflows/release.yaml | 7 ++- .github/workflows/validate.yaml | 9 ++-- .goreleaser.yaml | 13 +++--- README.md | 1 + docs/{git-age.md => git-age.adoc} | 71 ++++++++++++++++--------------- 5 files changed, 57 insertions(+), 44 deletions(-) rename docs/{git-age.md => git-age.adoc} (55%) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 683b7e7..986648a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 82fd274..b89c80f 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -32,12 +32,15 @@ jobs: # Semantic version range syntax or exact version of Go go-version: ${{ matrix.go-version }} + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + bundler-cache: true + - run: gem install asciidoctor + - 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 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 6f60395..7952e90 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -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: @@ -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 @@ -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 diff --git a/README.md b/README.md index f130596..75c729a 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/git-age.md b/docs/git-age.adoc similarity index 55% rename from docs/git-age.md rename to docs/git-age.adoc index 7db1c33..80695ac 100644 --- a/docs/git-age.md +++ b/docs/git-age.adoc @@ -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 @@ -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` , `--keys` ] 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` <COMMENT> `--keys` <KEYS_TXT>] +`git age gen-key` [`--comment` `--keys` ] -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` <COMMENT> `--keys` <KEYS_TXT> `--message` <COMMIT_MESSAGE>] -<PUBLIC_KEY>
+`git age add-recipient` [`--comment` `--keys` `--message` ] + + -### 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` <PATTERN> +`git age files track` 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` @@ -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:
+Bob: + git age gen-key --comment "Bob" > bob.pub -Alice:
-git age add-recipient --comment "Bob" $(cat bob.pub) \ No newline at end of file +Alice: + +git age add-recipient --comment "Bob" $(cat bob.pub)