From df69283267d2c82021e218ad21e273edf8726bcf Mon Sep 17 00:00:00 2001 From: Selena Goods Date: Fri, 10 Feb 2023 14:47:43 -0500 Subject: [PATCH] Switch to Changie for changelog automation (#222) --- .changes/0.13.0.md | 96 +++++++++++++++++++ .changes/unreleased/.gitkeep | 0 .../unreleased/NOTES-20230209-174759.yaml | 6 ++ .changie.yaml | 22 +++++ .github/workflows/release.yml | 72 ++++++++++++-- CHANGELOG.md | 6 -- 6 files changed, 190 insertions(+), 12 deletions(-) create mode 100644 .changes/0.13.0.md create mode 100644 .changes/unreleased/.gitkeep create mode 100644 .changes/unreleased/NOTES-20230209-174759.yaml create mode 100644 .changie.yaml diff --git a/.changes/0.13.0.md b/.changes/0.13.0.md new file mode 100644 index 00000000..eb34bdf9 --- /dev/null +++ b/.changes/0.13.0.md @@ -0,0 +1,96 @@ +# 0.13.0 (July 8, 2022) + +ENHANCEMENTS: + +* schemamd: Nested attributes are now correctly grouped in "optional", "required" and "read-only" ([#163](https://github.com/hashicorp/terraform-plugin-docs/pull/163)). + +BUG FIXES: + +* template functions: `title` now capitalizes each word in the input string, instead of upper-casing them ([#165](https://github.com/hashicorp/terraform-plugin-docs/pull/165)). + +# 0.12.0 (June 29, 2022) + +BUG FIXES: + +* template data: A regression was introduced in [#155](https://github.com/hashicorp/terraform-plugin-docs/pull/155) making template data field `HasExample` and `HasImport` always true ([#162](https://github.com/hashicorp/terraform-plugin-docs/pull/162)). + +NEW FEATURES: + +* template functions: Added `lower`, `upper` and `title` ([#162](https://github.com/hashicorp/terraform-plugin-docs/pull/162)). + +ENHANCEMENTS: + +* Added documentation for all the template functions and template data fields ([#162](https://github.com/hashicorp/terraform-plugin-docs/pull/162)). + +# 0.11.0 (June 28, 2022) + +NEW FEATURES: + +* cmd/tfplugindocs: Additional CLI argument `ignore-deprecated` allows to skip deprecated resources and data-sources when generating docs ([#154](https://github.com/hashicorp/terraform-plugin-docs/pull/154)). + +BUG FIXES: + +* cmd/tfplugindocs: Pass through filepaths for `examples` and `import` to allow use of `HasExample` and `HasImport` template helpers in custom templates ([#155](https://github.com/hashicorp/terraform-plugin-docs/pull/155)). +* cmd/tfplugindocs: Fixed issue with the generation of title and reference links, when nested attributes go too deep ([#56](https://github.com/hashicorp/terraform-plugin-docs/pull/56)). + +# 0.10.1 (June 14, 2022) + +BUG FIXES: + +* cmd/tfplugindocs: Do not error when schema not found, issue log warning ([#151](https://github.com/hashicorp/terraform-plugin-docs/pull/151)). + +# 0.10.0 (June 13, 2022) + +BUG FIXES: + +* cmd/tfplugindocs: Allow single word resources to use templates ([#147](https://github.com/hashicorp/terraform-plugin-docs/pull/147)). +* cmd/tfplugindocs: Pass in correct provider name for data-source and resource schema lookup when overidden with `rendered-provider-name` flag ([#148](https://github.com/hashicorp/terraform-plugin-docs/pull/148)). + +ENHANCEMENTS: + +* cmd/tfplugindocs: Expose `RenderedProviderName` to templates ([#149](https://github.com/hashicorp/terraform-plugin-docs/pull/149)). + +# 0.9.0 (June 1, 2022) + +NEW FEATURES: + +* cmd/tfplugindocs: Additional CLI arguments `provider-name`, `rendered-provider-name`, `rendered-website-dir`, `examples-dir`, `website-temp-dir`, and `website-source-dir`. These allow to further customise generated doc ([#95](https://github.com/hashicorp/terraform-plugin-docs/pull/95)). + +ENHANCEMENTS: + +* cmd/tfplugindocs: Implemented usage output (i.e. `--help`) for `generate` and `validate` commands ([#95](https://github.com/hashicorp/terraform-plugin-docs/pull/95)). + +# 0.8.1 (May 10, 2022) + +BUG FIXES: + +* cmd/tfplugindocs: Updated version of [hc-install](github.com/hashicorp/hc-install) in response to change in HashiCorp Release API [sending back a different `Content-Type` header](https://github.com/hashicorp/hc-install/issues/56). This was causing failures when the tool attempted to install Terraform. ([#135](https://github.com/hashicorp/terraform-plugin-docs/issues/135)) + +# 0.8.0 (May 3, 2022) + +ENHANCEMENTS: + +* template functions: Added `split` to help separating a string into substrings ([#70](https://github.com/hashicorp/terraform-plugin-docs/pull/70)). + +BUG FIXES: + +* cmd/tflugindocs: Support for schemas containing empty nested attributes or empty nested blocks ([#99](https://github.com/hashicorp/terraform-plugin-docs/pull/99), [#134](https://github.com/hashicorp/terraform-plugin-docs/pull/134)). +* schemamd: Attribute `ID` is considered "Read Only", unless there's a description defined, in which case it's handled like any other attribute in the schema ([#46](https://github.com/hashicorp/terraform-plugin-docs/pull/46), [#134](https://github.com/hashicorp/terraform-plugin-docs/pull/134)). + +# 0.7.0 (March 15, 2022) + +ENHANCEMENTS: + +* cmd/tfplugindocs: Use existing Terraform CLI binary if available on PATH, otherwise download latest Terraform CLI binary ([#124](https://github.com/hashicorp/terraform-plugin-docs/pull/124)). +* cmd/tfplugindocs: Added `tf-version` flag for specifying Terraform CLI binary version to download, superseding the PATH lookup ([#124](https://github.com/hashicorp/terraform-plugin-docs/pull/124)). + +BUG FIXES: + +* cmd/tfplugindocs: Swapped `.Type` and `.Name` resource and data source template fields so they correctly align ([#44](https://github.com/hashicorp/terraform-plugin-docs/pull/44)). +* schemamd: Switched attribute name rendering from bold text to code blocks so the Terraform Registry treats them as anchor links ([#59](https://github.com/hashicorp/terraform-plugin-docs/pull/59)). + +# 0.6.0 (March 14, 2022) + +NOTES: + +* dependencies: `github.com/hashicorp/terraform-exec` dependency has been updated to match `terraform-plugin-sdk`, which replaced the removed `tfinstall` package with `github.com/hashicorp/hc-install`. This will resolve Go build errors for projects that import both `terraform-plugin-docs` and `terraform-plugin-sdk`. diff --git a/.changes/unreleased/.gitkeep b/.changes/unreleased/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/.changes/unreleased/NOTES-20230209-174759.yaml b/.changes/unreleased/NOTES-20230209-174759.yaml new file mode 100644 index 00000000..4cc0447f --- /dev/null +++ b/.changes/unreleased/NOTES-20230209-174759.yaml @@ -0,0 +1,6 @@ +kind: NOTES +body: This Go module has been updated to Go 1.18 per the [Go support policy](https://go.dev/doc/devel/release#policy). + Any consumers building on earlier Go versions may experience errors +time: 2023-02-09T17:47:59.646473-05:00 +custom: + Issue: "199" diff --git a/.changie.yaml b/.changie.yaml new file mode 100644 index 00000000..1216b591 --- /dev/null +++ b/.changie.yaml @@ -0,0 +1,22 @@ +changesDir: .changes +unreleasedDir: unreleased +changelogPath: CHANGELOG.md +versionExt: md +versionFormat: '## {{.Version}} ({{.Time.Format "January 02, 2006"}})' +kindFormat: '{{.Kind}}:' +changeFormat: '* {{.Body}} ([#{{.Custom.Issue}}](https://github.com/hashicorp/terraform-plugin-docs/issues/{{.Custom.Issue}}))' +custom: + - key: Issue + label: Issue/PR Number + type: int + minInt: 1 +kinds: + - label: BREAKING CHANGES + - label: NOTES + - label: FEATURES + - label: ENHANCEMENTS + - label: BUG FIXES +newlines: + afterKind: 1 + beforeKind: 1 + endOfVersion: 2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97e8f998..19888a49 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,16 @@ name: release on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+*' + workflow_dispatch: + inputs: + versionNumber: + description: 'Release version number (v#.#.#)' + type: string + required: true + +env: + CI_COMMIT_AUTHOR: hc-github-team-tf-provider-devex + CI_COMMIT_EMAIL: github-team-tf-provider-devex@hashicorp.com permissions: # Allow creating GitHub release @@ -12,19 +19,72 @@ permissions: issues: write jobs: + changelog-version: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.changelog-version.outputs.version }} + steps: + - id: changelog-version + run: echo "version=$(echo "${{ inputs.versionNumber }}" | cut -c 2-)" >> "$GITHUB_OUTPUT" + changelog: + needs: changelog-version + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + fetch-depth: 0 + - name: Batch changes + uses: miniscruff/changie-action@b6d52c80deb236a5b548f8774cd5a18b87da9e9a # v1.0.1 + with: + version: latest + args: batch ${{ needs.changelog-version.outputs.version }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Merge changes + uses: miniscruff/changie-action@b6d52c80deb236a5b548f8774cd5a18b87da9e9a # v1.0.1 + with: + version: latest + args: merge + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Git push changelog + run: | + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" + git add . + git commit -a -m "Update changelog" + git push + release-tag: + needs: changelog + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + fetch-depth: 0 + - name: Git push release tag + run: | + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" + git pull + git tag "${{ inputs.versionNumber }}" + git push origin "${{ inputs.versionNumber }}" goreleaser: + needs: [ changelog-version, changelog, release-tag ] runs-on: ubuntu-latest steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 with: - # Required for release notes + ref: ${{ inputs.versionNumber }} fetch-depth: 0 - uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 with: go-version-file: 'go.mod' - name: Generate Release Notes - # Fetch CHANGELOG.md contents up to Git tag prior to this release, skipping top two lines - run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > /tmp/release-notes.txt + run: | + cd .changes + sed -e "1{/# /d;}" -e "2{/^$/d;}" ${{ needs.changelog-version.outputs.version }}.md > /tmp/release-notes.txt - uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 74d9025c..eb34bdf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,3 @@ -# 0.14.0 (unreleased) - -NOTES: - -* This Go module has been updated to Go 1.18 per the [Go support policy](https://go.dev/doc/devel/release#policy). Any consumers building on earlier Go versions may experience errors ([#199](https://github.com/hashicorp/terraform-plugin-docs/pull/199)). - # 0.13.0 (July 8, 2022) ENHANCEMENTS: