Skip to content

Commit

Permalink
docs: write documentation for upcoming v0.8.0 release (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
purpleclay authored Jun 10, 2024
1 parent cd458ab commit ae6dde1
Show file tree
Hide file tree
Showing 25 changed files with 368 additions and 103 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
uses: purpleclay/github/.github/workflows/go-test.yml@main
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-24.04, macos-14, windows-2022]
with:
go-version: ${{ vars.GO_VERSION }}
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}

lint:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ permissions:

jobs:
build-docs:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -31,7 +31,7 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ secrets.GH_GHCR }}

- run: docker pull ghcr.io/purpleclay/mkdocs-material-insiders:${{ vars.MKDOCS_MATERIAL_INSIDERS_VERSION }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nsv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

jobs:
nsv:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:

jobs:
goreleaser:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Git Clone
uses: actions/checkout@v4
Expand Down Expand Up @@ -48,13 +48,6 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: GitLab Login
uses: docker/login-action@v3
with:
registry: registry.gitlab.com
username: ${{ secrets.GL_DOCKER_USERNAME }}
password: ${{ secrets.GL_DOCKER_PASSWORD }}

- name: GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:

jobs:
shellcheck:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: shellcheck
steps:
- name: Checkout repository
Expand Down
13 changes: 1 addition & 12 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ archives:
{{- if .Arm }}v{{ .Arm }}{{ end }}
builds:
- nsv
rlcp: true
format_overrides:
- goos: windows
format: zip
Expand All @@ -58,7 +57,7 @@ changelog:
- "^ci"
groups:
- title: "Dependency Updates"
regexp: "^.*feat\\(deps\\)*:+.*$"
regexp: "^.*fix\\(deps\\)*:+.*$"
order: 30
- title: "New Features"
regexp: "^.*feat[(\\w)]*:+.*$"
Expand Down Expand Up @@ -100,7 +99,6 @@ dockers:
- image_templates:
- "purpleclay/nsv:{{ .Tag }}-amd64"
- "ghcr.io/purpleclay/nsv:{{ .Tag }}-amd64"
- "registry.gitlab.com/purpleclay/nsv:{{ .Tag }}-amd64"
dockerfile: Dockerfile
use: buildx
build_flag_templates:
Expand All @@ -117,7 +115,6 @@ dockers:
- image_templates:
- "purpleclay/nsv:{{ .Tag }}-arm64"
- "ghcr.io/purpleclay/nsv:{{ .Tag }}-arm64"
- "registry.gitlab.com/purpleclay/nsv:{{ .Tag }}-arm64"
dockerfile: Dockerfile
use: buildx
build_flag_templates:
Expand All @@ -142,10 +139,6 @@ docker_manifests:
image_templates:
- "ghcr.io/purpleclay/nsv:{{ .Tag }}-amd64"
- "ghcr.io/purpleclay/nsv:{{ .Tag }}-arm64"
- name_template: "registry.gitlab.com/purpleclay/nsv:{{ .Tag }}"
image_templates:
- "registry.gitlab.com/purpleclay/nsv:{{ .Tag }}-amd64"
- "registry.gitlab.com/purpleclay/nsv:{{ .Tag }}-arm64"
- name_template: "purpleclay/nsv:latest"
image_templates:
- "purpleclay/nsv:{{ .Tag }}-amd64"
Expand All @@ -154,10 +147,6 @@ docker_manifests:
image_templates:
- "ghcr.io/purpleclay/nsv:{{ .Tag }}-amd64"
- "ghcr.io/purpleclay/nsv:{{ .Tag }}-arm64"
- name_template: "registry.gitlab.com/purpleclay/nsv:latest"
image_templates:
- "registry.gitlab.com/purpleclay/nsv:{{ .Tag }}-amd64"
- "registry.gitlab.com/purpleclay/nsv:{{ .Tag }}-arm64"

brews:
- name: nsv
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ The power is at your fingertips.
### Features

- First-class support for semantic versioning. Conventional commits help give it a nudge in the right direction.
- Configure your Conventional Commit prefixes for complete control.
- If you batch your commits per release or prefer a continuous delivery approach, it has you covered.
- Context-aware, it automatically switches to a monorepo workflow.
- Extend the power of your commits through commands to dynamically change your semantic release workflow.
- Explore how to use it within the purpose-built playground.
- Get up and running in seconds within GitHub and GitLab with the available [action](https://github.com/purpleclay/nsv-action) or [template](https://gitlab.com/purpleclay/nsv).
- First class [Dagger](https://dagger.io/) support.

## Documentation

Expand Down
7 changes: 7 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,10 @@ tasks:
TEST_OPTIONS: '{{default "-bench=. -benchtime 5s -benchmem" .TEST_OPTIONS}}'
cmds:
- go test {{.TEST_OPTIONS}} -run=^# ./...

docs:
desc: Builds and hosts the MkDocs documentation
vars:
MKDOCS_MATERIAL_VERSION: '{{default "9.5.26-insiders-4.53.11" .MKDOCS_MATERIAL_VERSION}}'
cmds:
- docker run --rm -it -p 8000:8000 -v $PWD:/docs ghcr.io/purpleclay/mkdocs-material-insiders:{{.MKDOCS_MATERIAL_VERSION}}
84 changes: 84 additions & 0 deletions docs/ci/dagger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
icon: material/sword
social:
cards: false
status: new
---

# Using Dagger in your CI

<span class="rounded-pill">:material-test-tube: experimental</span>

## GitHub Action

Run [nsv](https://daggerverse.dev/mod/github.com/purpleclay/daggerverse/nsv) using the official Dagger [GitHub Action](https://github.com/dagger/dagger-for-github). The Dagger Cloud offers enhanced layer caching, which can be enabled by setting a `DAGGER_CLOUD_TOKEN` environment variable.

```{.yaml .no-select linenums="1"}
name: ci
on:
push:
branches:
- main
jobs:
nsv:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_NSV }} # (1)!
- name: Tag
uses: dagger/dagger-for-github@v5
env:
GPG_PRIVATE_KEY: "${{ secrets.GPG_PRIVATE_KEY }}"
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
with:
verb: call
module: github.com/purpleclay/daggerverse/nsv
args: --src . tag --show --gpg-private-key env:GPG_PRIVATE_KEY --gpg-passphrase env:GPG_PASSPHRASE
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
```

1. A PAT token triggers another workflow after tagging the repository; this is optional.

## GitLab Template

The same Dagger experience is possible within GitLab using the Purple Clay [template](https://gitlab.com/purpleclay/templates/-/blob/main/dagger/README.md?ref_type=heads). The Dagger Cloud offers enhanced layer caching, which can be enabled by setting a `DAGGER_CLOUD_TOKEN` environment variable.

```{.yaml .no-select linenums="1" hl_lines="28-29"}
include:
- "https://gitlab.com/purpleclay/templates/-/raw/dagger/0.11.6/dagger/Mixed.gitlab-ci.yml"
nsv:
extends: [.dagger]
stage: release
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_MERGE_REQUEST_IID
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
variables:
GIT_DEPTH: 0
GIT_STRATEGY: clone
DAGGER_MODULE: "github.com/purpleclay/daggerverse/nsv"
DAGGER_ARGS: >-
--src .
tag
--show
--paths ${WORKING_DIRECTORY}
--gpg-private-key env:NSV_GPG_PRIVATE_KEY
--gpg-passphrase env:NSV_GPG_PASSPHRASE
before_script: # (1)!
- PROJECT_URL=${CI_PROJECT_URL#"https://"}
- git remote set-url origin "https://oauth2:${NSV_GITLAB_TOKEN}@${PROJECT_URL}.git"
```

1. To push a newly created tag, an access token with `:write_repository` permissions is required. Here, it is assigned to the `NSV_GITLAB_TOKEN` CI variable.
2 changes: 1 addition & 1 deletion docs/github-action.md → docs/ci/github-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To get up and running within a GitHub workflow, include the publicly available `

If you wish to tag the repository without triggering another workflow, you must set the permissions of the job to `contents: write`.

```{.yaml linenums="1" hl_lines="10"}
```{.yaml .no-select linenums="1" hl_lines="10"}
name: ci
on:
push:
Expand Down
2 changes: 1 addition & 1 deletion docs/gitlab-template.md → docs/ci/gitlab-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To get up and running within a GitLab pipeline, include the publicly available `

## Tagging a repository

```{.yaml linenums="1"}
```{.yaml .no-select linenums="1"}
include:
- https://gitlab.com/purpleclay/nsv/-/raw/main/nsv.gitlab-ci.yml
```
1 change: 0 additions & 1 deletion docs/commands.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
icon: material/apple-keyboard-command
description: Advanced control of semantic versioning through dedicated commands
status: new
---

# Control your workflow with Commands
Expand Down
46 changes: 46 additions & 0 deletions docs/configurable-prefixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
icon: material/apple-keyboard-command
description: Advanced control of semantic versioning through dedicated commands
status: new
---

# Configure your Conventional prefixes

[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) offers a fantastic approach to controlling semantic versioning through commit prefixes. An industry standard convention devised by the Angular team is most commonly used to date.

- `BREAKING CHANGE`: any commit with this footer triggers a major update.
- `!`: any conventional prefix with this suffix (e.g. `refactor!`) triggers a major update.
- `feat`: triggers a minor update.
- `fix`: triggers a patch update.

## Defining your own rules

- `breaking`: triggers a major update `1.0.0` ~> `2.0.0`.
- `feat`, `deps`: triggers a minor update `0.1.0` ~> `0.2.0`.
- `fix`, `docs`, `styles`: triggers a patch update `0.3.1` ~> `0.3.2`.

=== "ENV"

```{ .sh .no-select }
NSV_MAJOR_PREFIXES=breaking \
NSV_MINOR_PREFIXES=feat,deps \
NSV_PATCH_PREFIXES=fix,docs,styles \
nsv next
```

=== "CLI"

```{ .sh .no-select }
nsv next --major-prefixes breaking \
--minor-prefixes feat,deps \
--patch-prefixes fix,docs,styles
```

Don't worry—when defining your custom prefixes, both the `BREAKING CHANGE` footer and the `!` suffix are automatically supported.

## How prefix matching works

`nsv` matches a prefix in one of two ways:

- `breaking` is a <u>wildcard</u> prefix capable of matching against an optional scope.
- `breaking(api)` is an <u>exact</u> match only.
Loading

0 comments on commit ae6dde1

Please sign in to comment.