diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 844e7133..c892152f 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -15,14 +15,15 @@ jobs: - name: Create Changelog id: release_number_and_changelog - uses: taliesins/conventional-changelog-action@releases/v3 + uses: TriPSs/conventional-changelog-action@releases/v4 with: github-token: ${{ secrets.CREATE_TAG_GITHUB_TOKEN }} skip-version-file: 'true' skip-on-empty: 'false' skip-commit: 'true' skip-tag: 'true' - dry-run: 'true' + #dry-run: 'true' + git-push: 'false' tag-prefix: 'v' output-file: 'false' @@ -33,14 +34,14 @@ jobs: FILE_DATA: ${{ steps.release_number_and_changelog.outputs.clean_changelog }} - name: Create Changelog and commit - uses: taliesins/conventional-changelog-action@releases/v3 + uses: TriPSs/conventional-changelog-action@releases/v4 with: github-token: ${{ secrets.CREATE_TAG_GITHUB_TOKEN }} skip-version-file: 'true' skip-on-empty: 'false' skip-commit: 'false' skip-tag: 'false' - dry-run: 'false' + #dry-run: 'false' force-push: 'true' tag-prefix: 'v' output-file: 'CHANGELOG.md' \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 35e7d5af..5fa91db4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -251,7 +251,7 @@ jobs: needs: [go_mod_download] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-go@v4 @@ -265,7 +265,7 @@ jobs: key: ${{ hashFiles('.github/workflows/release.yml') }}-${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} - name: goreleaser check continue-on-error: true - uses: goreleaser/goreleaser-action@v4.2.0 + uses: goreleaser/goreleaser-action@v5 with: args: check - name: Import GPG key @@ -275,12 +275,25 @@ jobs: with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} #passphrase: ${{ secrets.PASSPHRASE }} + - name: Get tag_name id: tag_name if: startsWith(github.ref, 'refs/tags/v') run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "lts/*" + - name: Install dependencies + run: npm i -D semantic-release @semantic-release/{commit-analyzer,release-notes-generator,changelog,git,github} + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: semantic-release $DRY_RUN_OPT + - name: goreleaser release - uses: goreleaser/goreleaser-action@v4.2.0 + uses: goreleaser/goreleaser-action@v5 if: startsWith(github.ref, 'refs/tags/v') with: version: latest @@ -289,51 +302,16 @@ jobs: GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GORELEASER_CURRENT_TAG: ${{ steps.tag_name.outputs.VERSION }} - - name: Create Changelog - id: release_number_and_changelog - uses: taliesins/conventional-changelog-action@releases/v3 - if: "!(startsWith(github.ref, 'refs/tags/v'))" - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - skip-version-file: 'true' - skip-on-empty: 'false' - skip-commit: 'true' - skip-tag: 'true' - dry-run: 'true' - tag-prefix: 'v' - output-file: 'CHANGELOG.md' - - name: Create clean changelog - uses: "finnp/create-file-action@master" - if: "!(startsWith(github.ref, 'refs/tags/v'))" - env: - FILE_NAME: ".github/CLEANCHANGELOG.md" - FILE_DATA: ${{ steps.release_number_and_changelog.outputs.clean_changelog }} - - - name: Get release information - if: "!(startsWith(github.ref, 'refs/tags/v'))" - env: - CLEAN_CHANGELOG: ${{ steps.release_number_and_changelog.outputs.clean_changelog }} - CHANGELOG: ${{ steps.release_number_and_changelog.outputs.changelog }} - VERSION: ${{ steps.release_number_and_changelog.outputs.version }} - OLDVERSION: ${{ steps.release_number_and_changelog.outputs.old_version }} - TAG: ${{ steps.release_number_and_changelog.outputs.tag }} - SKIPPED: ${{ steps.release_number_and_changelog.outputs.skipped }} - run: | - echo "clean_changelog: $CLEAN_CHANGELOG" - echo "changelog: $CHANGELOG" - echo "version: $VERSION" - echo "old_version: $OLDVERSION" - echo "tag: $TAG" - echo "skipped: $SKIPPED" - name: goreleaser snapshot - uses: goreleaser/goreleaser-action@v4.2.0 + uses: goreleaser/goreleaser-action@v5 if: "!(startsWith(github.ref, 'refs/tags/v'))" with: args: release --rm-dist --skip-sign --snapshot --timeout ${{ env.RELEASE_TIME_OUT }} --release-notes=.github/CLEANCHANGELOG.md env: GORELEASER_CURRENT_TAG: v0.0.0 GORELEASER_PREVIOUS_TAG: v0.0.0 + - name: snapshot artifact naming id: naming if: "!(startsWith(github.ref, 'refs/tags/v'))" @@ -348,6 +326,7 @@ jobs: ARTIFACT="${GITHUB_REF}";; esac echo "::set-output name=artifact::$ARTIFACT-$(date -u +'%Y-%m-%dT%H-%M')" + - name: upload snapshot artifact uses: actions/upload-artifact@v3 if: "!(startsWith(github.ref, 'refs/tags/v'))" diff --git a/.gitignore b/.gitignore index 7c17f98b..08503a7e 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,9 @@ website/vendor *.winfile eol=crlf /vendor /act +/node_modules +/package-lock.json +/package.json +/.vs +/.idea +/.terraform diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 00000000..e71be2ab --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,73 @@ +{ + "branches": [ + "master", + { + "name": "develop", + "prerelease": true + } + ], + "ci": true, + "debug": true, + "dryRun": true, + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "angular", + "releaseRules": [ + { "tag": "Breaking", "release": "major" }, + { "tag": "Build", "release": "minor" }, + { "tag": "Chore", "release": "minor" }, + { "tag": "Fix", "release": "patch" }, + { "tag": "New", "release": "minor" }, + { "tag": "Update", "release": "minor" }, + { "tag": "Upgrade", "release": "minor" } + ], + "parserOpts": { + "noteKeywords": [ + "BREAKING CHANGE", + "BREAKING CHANGES", + "BREAKING" + ] + } + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "angular", + "releaseRules": [ + { "tag": "Breaking", "release": "major" }, + { "tag": "Build", "release": "minor" }, + { "tag": "Chore", "release": "minor" }, + { "tag": "Fix", "release": "patch" }, + { "tag": "New", "release": "minor" }, + { "tag": "Update", "release": "minor" }, + { "tag": "Upgrade", "release": "minor" } + ], + "parserOpts": { + "noteKeywords": [ + "BREAKING CHANGE", + "BREAKING CHANGES", + "BREAKING" + ] + }, + "writerOpts": { + "commitsSort": [ + "subject", + "scope" + ] + } + } + ], + [ + "@semantic-release/changelog", + { + "changelogFile": "CHANGELOG.md", + "changelogTitle": "# HyperV Terraform Provider Changelog" + } + ] + ], + "repositoryUrl": "https://github.com/taliesins/terraform-provider-hyperv", + "tagFormat": "v${version}" +} \ No newline at end of file