diff --git a/.changelog/30.txt b/.changelog/30.txt new file mode 100644 index 0000000..8197efe --- /dev/null +++ b/.changelog/30.txt @@ -0,0 +1,3 @@ +```release-note:dependency +deps: bump github.com/hashicorp/terraform-plugin-framework from 1.2.0 to 1.3.0 +``` \ No newline at end of file diff --git a/.changelog/31.txt b/.changelog/31.txt new file mode 100644 index 0000000..f02968c --- /dev/null +++ b/.changelog/31.txt @@ -0,0 +1,3 @@ +```release-note:dependency +deps: bump github.com/hashicorp/terraform-plugin-go from 0.15.0 to 0.16.0 +``` \ No newline at end of file diff --git a/.changelog/32.txt b/.changelog/32.txt new file mode 100644 index 0000000..c3df86e --- /dev/null +++ b/.changelog/32.txt @@ -0,0 +1,3 @@ +```release-note:dependency +deps: bump github.com/hashicorp/terraform-plugin-framework from 1.3.0 to 1.3.1 +``` \ No newline at end of file diff --git a/.ci b/.ci new file mode 160000 index 0000000..875af0d --- /dev/null +++ b/.ci @@ -0,0 +1 @@ +Subproject commit 875af0d9a97435235bff7f863422742a96f4a0d3 diff --git a/.github/workflows/dependabot_changelog.yml b/.github/workflows/dependabot_changelog.yml new file mode 100644 index 0000000..3450dc6 --- /dev/null +++ b/.github/workflows/dependabot_changelog.yml @@ -0,0 +1,35 @@ +name: Add CHANGELOG for dependabot changes +on: pull_request_target +permissions: + pull-requests: write + issues: write + repository-projects: write + contents: write +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} + steps: + - name: Fetch dependabot metadata + id: dependabot-metadata + uses: dependabot/fetch-metadata@cd6e996708b8cfe0b639401134a3b9a3177be7b2 # v1.5.1 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - run: | + gh pr checkout $PR_URL + cat << EOF > .changelog/$PR_NUMBER.txt + \`\`\`release-note:dependency + deps: bumps $DEP_NAME from $DEP_PREV_VERSION to $DEP_NEXT_VERSION + \`\`\` + EOF + git config user.name github-actions[bot] + git config user.email github-actions[bot]@users.noreply.github.com + git add .changelog/$PR_NUMBER.txt + git commit -m "add CHANGELOG for #$PR_NUMBER" + git push + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} + PR_NUMBER: ${{ github.event.pull_request.number }} + DEP_NAME: ${{ steps.dependabot-metadata.outputs.dependency-names }} + DEP_PREV_VERSION: ${{ steps.dependabot-metadata.outputs.previous-version }} + DEP_NEXT_VERSION: ${{ steps.dependabot-metadata.outputs.new-version }} \ No newline at end of file diff --git a/.github/workflows/generate_changelog.yml b/.github/workflows/generate_changelog.yml new file mode 100644 index 0000000..c8bb296 --- /dev/null +++ b/.github/workflows/generate_changelog.yml @@ -0,0 +1,33 @@ +name: Generate CHANGELOG +on: + pull_request: + types: [closed] + workflow_dispatch: +jobs: + GenerateChangelog: + if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + fetch-depth: 0 + submodules: true + token: ${{ secrets.CHANGELOG_PAT }} + - uses: actions/setup-go@v4.0.1 + with: + go-version-file: '.ci/tools/go.mod' + - run: go generate -tags tools .ci/tools/tools.go + - run: ./.ci/scripts/generate-changelog.sh + - run: | + if [[ `git status --porcelain` ]]; then + if ${{github.event_name == 'workflow_dispatch'}}; then + MSG="chore: update CHANGELOG.md (Manual Trigger)" + else + MSG="chore: update CHANGELOG.md for #${{ github.event.pull_request.number }}" + fi + git config --local user.email changelogbot@frangipane.io + git config --local user.name changelogbot + git add CHANGELOG.md + git commit -m "$MSG" + git push + fi \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 09a8e07..19f85f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,20 +2,99 @@ name: Release on: push: - branches: - - main + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' jobs: - release_please: - name: Release Please - runs-on: ubuntu-22.04 - if: github.repository == 'FrangipaneTeam/terraform-plugin-framework-planmodifiers' + release-notes: + runs-on: ubuntu-latest steps: - - uses: google-github-actions/release-please-action@v3 - id: release + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - token: ${{ secrets.GITHUB_TOKEN }} - release-type: simple - bump-minor-pre-major: true - bump-patch-for-minor-pre-major: true - changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"deps","section":"Dependencies","hidden":false},{"type":"docs","section":"Documentation","hidden":false}]' + fetch-depth: 0 + - name: Generate Release Notes + run: | + export PREV_TAG=$(git tag --list 'v*' --sort=-version:refname | head -n 2 | tail -n 1) + export PREV_VERSION=${PREV_TAG//v} + sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $PREV_VERSION/q;p" CHANGELOG.md > release-notes.txt + - uses: actions/upload-artifact@v3 + with: + name: release-notes + path: release-notes.txt + retention-days: 1 + + make-release: + runs-on: ubuntu-latest + needs: [release-notes] + permissions: + contents: write + steps: + - id: release-notes-download + name: Release Notes Download + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: release-notes + path: /tmp + - uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # v1.12.0 + with: + bodyFile: "${{ steps.release-notes-download.outputs.download-path }}/release-notes.txt" + + highest-version-tag: + needs: [make-release] + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.highest-version-tag.outputs.tag }} + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + # Allow tag to be fetched when ref is a commit + fetch-depth: 0 + - name: Output highest version tag + id: highest-version-tag + run: | + HIGHEST=$(git tag | sort -V | tail -1) + echo "tag=$HIGHEST" >> "$GITHUB_OUTPUT" + + changelog-newversion: + needs: [make-release, highest-version-tag] + # write new changelog header only if release tag is the $HIGHEST i.e. exists on main + # and not a backport release branch (e.g. release/3.x). This results in + # manually updating the CHANGELOG header if releasing from the non-default branch. + # TODO: find a more deterministic way to determine release branch from tag commit + if: github.ref_name == needs.highest-version-tag.outputs.tag + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + fetch-depth: 0 + ref: main + token: ${{ secrets.CHANGELOG_PAT }} + - name: Update Changelog Header + run: | + CHANGELOG_FILE_NAME="CHANGELOG.md" + PREVIOUS_RELEASE_TAG=${{ github.ref_name }} + + # Add Release Date + RELEASE_DATE=`date +%B' '%e', '%Y` + sed -i -e "1 s/.*Unreleased.*/## ${PREVIOUS_RELEASE_TAG#v} ($RELEASE_DATE)/" $CHANGELOG_FILE_NAME + + # Prepend next release line + echo Previous release is: $PREVIOUS_RELEASE_TAG + + NEW_RELEASE_LINE=$(echo $PREVIOUS_RELEASE_TAG | awk -F. '{ + $1 = substr($1,2) + $2 += 1 + printf("%s.%01d.0\n\n", $1, $2); + }') + + echo New minor version is: v$NEW_RELEASE_LINE + + echo -e "## $NEW_RELEASE_LINE (Unreleased)\n$(cat $CHANGELOG_FILE_NAME)" > $CHANGELOG_FILE_NAME + - run: | + git config --local user.email changelogbot@frangipane.io + git config --local user.name changelogbot + git add CHANGELOG.md + git commit -m "Update CHANGELOG.md after ${{ github.ref_name }}" + git push \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2afed57 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule ".ci"] + path = .ci + url = https://github.com/FrangipaneTeam/release-ci diff --git a/CHANGELOG.md b/CHANGELOG.md index c67b7e6..7821946 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,6 @@ -# Changelog - -## [1.3.1](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/compare/v1.3.0...v1.3.1) (2023-06-20) - - -### Miscellaneous - -* **deps:** bump github.com/hashicorp/terraform-plugin-framework ([#32](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/issues/32)) ([35e15ba](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/35e15ba3792442592ae5ad53a8709aa1d98b9755)) -* **deps:** bump github.com/hashicorp/terraform-plugin-go ([#31](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/issues/31)) ([70a3770](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/70a3770de13256f88f56f22394300c572a725d5f)) - -## [1.3.0](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/compare/v1.2.3...v1.3.0) (2023-06-19) +## 1.4.0 (Unreleased) +## 1.3.0 (2023-06-19) ### Features @@ -18,7 +9,6 @@ * add `ToUpper` string changer ([d31513b](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/d31513b0877ba7b3fdc4cdd2616ebd56889cd605)) * add string/bool/int plan modifiers and docs ([7f2a62b](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/7f2a62bdf65e409f16c393e5d9715a149a38a3f2)) - ### Bug Fixes * ci trigger github page ([fbfcc7b](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/fbfcc7b5b97094c72daf61336a2e8bad709cecce)) @@ -27,12 +17,10 @@ * fix types in ToUpper and ToLower Func ([75d8a45](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/75d8a45823b7384e397a000bf027e73a5997d884)) * syntax in doc ([08cb4fe](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/08cb4fe793bfcdae344d3fb01200b96c8a23e853)) - ### Documentation * merge doc to one projet ([5913ccc](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/5913ccc947cd7982f6d4b3dbbc8c842bd2d7f51c)) - ### Miscellaneous * CODE_OF_CONDUCT ([505baa5](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/505baa54e9cda726cf409d31fc6444c996c630fe)) @@ -50,30 +38,26 @@ * **main:** release 1.2.3 ([e6547db](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/e6547db7be4859bb5b1e03b15fe2fa34d5de4f2f)) * update README ([7408d42](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/7408d42fba7eceb314fb2af76d2742396fd699e2)) -## [1.2.3](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/compare/v1.2.2...v1.2.3) (2023-03-31) - +## 1.2.3 (2023-03-31) ### Miscellaneous * CODE_OF_CONDUCT ([505baa5](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/505baa54e9cda726cf409d31fc6444c996c630fe)) * LICENCE ([f5612de](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/f5612dea20d4c12e6ce632103fdeb388a0a86928)) -## [1.2.2](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/compare/v1.2.1...v1.2.2) (2023-03-29) - +## 1.2.2 (2023-03-29) ### Documentation * merge doc to one projet ([5913ccc](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/5913ccc947cd7982f6d4b3dbbc8c842bd2d7f51c)) - ### Miscellaneous * **deps:** bump github.com/hashicorp/terraform-plugin-framework ([380e499](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/380e49938e47200ac1d13f5626833b249963d70f)) * **deps:** bump github.com/hashicorp/terraform-plugin-go ([f9cee65](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/f9cee65dac07040984683c51f8c2ec6983619731)) * **docs:** add favicon && branding orange ([495273d](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/495273d6fa36cb2025dcc60b016b09c6b9f1ed09)) -## [1.2.1](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/compare/v1.2.0...v1.2.1) (2023-03-20) - +## 1.2.1 (2023-03-20) ### Bug Fixes @@ -81,33 +65,28 @@ * fix types in ToUpper and ToLower Func ([75d8a45](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/75d8a45823b7384e397a000bf027e73a5997d884)) * syntax in doc ([08cb4fe](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/08cb4fe793bfcdae344d3fb01200b96c8a23e853)) -## [1.2.0](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/compare/v1.1.1...v1.2.0) (2023-03-10) - +## 1.2.0 (2023-03-10) ### Features * add `ToLower` string changer ([f51594c](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/f51594c372a7101505bf14c74467eaae877f9b6d)) * add `ToUpper` string changer ([d31513b](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/d31513b0877ba7b3fdc4cdd2616ebd56889cd605)) - ### Bug Fixes * ci trigger github page ([fbfcc7b](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/fbfcc7b5b97094c72daf61336a2e8bad709cecce)) - ### Miscellaneous * update README ([7408d42](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/7408d42fba7eceb314fb2af76d2742396fd699e2)) -## [1.1.1](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/compare/v1.1.0...v1.1.1) (2023-03-09) - +## 1.1.1 (2023-03-09) ### Bug Fixes * ci trigger github page ([7731405](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/77314051f770e1f9686e55b8ca244668693c473b)) -## [1.1.0](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/compare/v1.0.0...v1.1.0) (2023-03-09) - +## 1.1.0 (2023-03-09) ### Features @@ -115,7 +94,6 @@ ## 1.0.0 (2023-03-09) - ### Features * add string/bool/int plan modifiers and docs ([7f2a62b](https://github.com/FrangipaneTeam/terraform-plugin-framework-planmodifiers/commit/7f2a62bdf65e409f16c393e5d9715a149a38a3f2))