diff --git a/.changes/header.tpl.md b/.changes/header.tpl.md new file mode 100644 index 00000000..825c32f0 --- /dev/null +++ b/.changes/header.tpl.md @@ -0,0 +1 @@ +# Changelog diff --git a/.changes/unreleased/.gitkeep b/.changes/unreleased/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/.changes/v0.5.31.md b/.changes/v0.5.31.md new file mode 100644 index 00000000..0bf49300 --- /dev/null +++ b/.changes/v0.5.31.md @@ -0,0 +1,3 @@ +## v0.5.31 - 2024-11-04 +### Added +* Initialized a changelog diff --git a/.changie.yaml b/.changie.yaml new file mode 100644 index 00000000..78ab6e36 --- /dev/null +++ b/.changie.yaml @@ -0,0 +1,26 @@ +changesDir: .changes +unreleasedDir: unreleased +headerPath: header.tpl.md +changelogPath: CHANGELOG.md +versionExt: md +versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}' +kindFormat: '### {{.Kind}}' +changeFormat: '* {{.Body}}' +kinds: + - label: Added + auto: minor + - label: Changed + auto: major + - label: Deprecated + auto: minor + - label: Removed + auto: major + - label: Fixed + auto: patch + - label: Security + auto: patch +newlines: + afterChangelogHeader: 1 + beforeChangelogVersion: 1 + endOfVersion: 1 +envPrefix: CHANGIE_ diff --git a/.github/scripts/check-work-copy-equals-to-committed.sh b/.github/scripts/check-work-copy-equals-to-committed.sh deleted file mode 100644 index 9d4b455a..00000000 --- a/.github/scripts/check-work-copy-equals-to-committed.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -MESSAGE="$1" - -CODE_DIFF="$(git diff)" -if [ -n "$CODE_DIFF" ]; then - echo "$MESSAGE" - echo - echo "$CODE_DIFF" - exit 1; -fi diff --git a/.github/scripts/format-all-go-code.sh b/.github/scripts/format-all-go-code.sh deleted file mode 100644 index 6057a36f..00000000 --- a/.github/scripts/format-all-go-code.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -DIR="$1" - -cd "$DIR" - -export PATH="$(go env GOPATH)/bin:$PATH" -for FILE in $(find . -name '*.go'); do - if [ "YES" == "$(bash ./.github/scripts/is_autogenerated_file.sh "$FILE")" ]; then - echo "Skip autogenerated file: $FILE" >&2 - continue - fi - - if [[ "$FILE" == *"allocator_go1.18.go"* ]]; then - echo "Skip allocator_go1.18.go rule: $FILE" >&2 - continue - fi - - bash ./.github/scripts/format-go-code.sh "$FILE" -done diff --git a/.github/scripts/format-go-code.sh b/.github/scripts/format-go-code.sh deleted file mode 100644 index b1ed4cf9..00000000 --- a/.github/scripts/format-go-code.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -FILEPATH="$1" - -gofmt -s -w "$FILEPATH" - -# https://github.com/rinchsan/gosimports -gosimports -local github.com/ydb-platform/ydb-kubernetes-operator -w "$FILEPATH" - -# https://github.com/mvdan/gofumpt -gofumpt -w "$FILEPATH" diff --git a/.github/scripts/is_autogenerated_file.sh b/.github/scripts/is_autogenerated_file.sh deleted file mode 100644 index 04a5d4b1..00000000 --- a/.github/scripts/is_autogenerated_file.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -FILEPATH="$1" - -grep -q "Code generated by gtrace. DO NOT EDIT." "$FILEPATH" && echo YES && exit 0 -grep -q "Code generated by MockGen. DO NOT EDIT." "$FILEPATH" && echo YES && exit 0 -grep -q "Code generated by controller-gen. DO NOT EDIT." "$FILEPATH" && echo YES && exit 0 - -echo NO -exit 0 diff --git a/.github/workflows/create-release-pr.yaml b/.github/workflows/create-release-pr.yaml new file mode 100644 index 00000000..fb2f96cc --- /dev/null +++ b/.github/workflows/create-release-pr.yaml @@ -0,0 +1,38 @@ +name: create-release-pr + +on: + workflow_dispatch: + +jobs: + create-release-pr: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: batch-changes + uses: miniscruff/changie-action@v2 + with: + version: latest + args: batch patch + + - name: merge-changes + uses: miniscruff/changie-action@v2 + with: + version: latest + args: merge + + - name: print the latest version + id: latest + uses: miniscruff/changie-action@v2 + with: + version: latest + args: latest + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + title: Release ${{ steps.latest.outputs.output }} + branch: release/${{ steps.latest.outputs.output }} + commit-message: Release ${{ steps.latest.outputs.output }} + token: ${{ github.token }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 683976dd..1e828d36 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -21,26 +21,6 @@ jobs: uses: golangci/golangci-lint-action@v2 with: version: v1.58.1 - code-format-check: - concurrency: - group: lint-autoformat-${{ github.head_ref || github.ref_name }} - cancel-in-progress: true - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup-go - uses: actions/setup-go@v3 - with: - go-version: '1.20' - - name: install-utilities - run: | - go install mvdan.cc/gofumpt@v0.5.0 - go install github.com/rinchsan/gosimports/cmd/gosimports@v0.3.8 - - name: format all files with auto-formatter - run: bash ./.github/scripts/format-all-go-code.sh "$PWD" - - name: check-repository-diff - run: bash ./.github/scripts/check-work-copy-equals-to-committed.sh "auto-format broken" run-unit-tests: concurrency: group: run-unit-tests-${{ github.head_ref || github.ref_name }} diff --git a/.github/workflows/upload-artifacts.yml b/.github/workflows/upload-artifacts.yml index 6979673c..fc02101b 100644 --- a/.github/workflows/upload-artifacts.yml +++ b/.github/workflows/upload-artifacts.yml @@ -1,29 +1,45 @@ name: upload-artifacts + on: push: branches: - master + paths: + - 'CHANGELOG.md' + workflow_dispatch: + jobs: - tag-job: + tag-and-release: runs-on: ubuntu-latest - outputs: - tagcreated: ${{steps.tag-step.outputs.tagcreated}} steps: - - uses: actions/checkout@v3 - - id: tag-step - uses: butlerlogic/action-autotag@1.1.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v4 + + - name: get-latest-version + uses: miniscruff/changie-action@v2 with: - strategy: regex - root: "./deploy/ydb-operator/Chart.yaml" - regex_pattern: 'version:[\s]*(["]?[0-9\.]{3,}["]?)' - upload-artifacts: - runs-on: ubuntu-latest - needs: tag-job - if: ${{ needs.tag-job.outputs.tagcreated == 'yes' }} - steps: - - uses: actions/checkout@v3 + version: latest + args: latest + - name: get-latest-no-v-version + uses: miniscruff/changie-action@v2 + with: + version: latest + # Echoes the same version as previous step, but without "v" prefix. + # Is used as a docker image tag in the release step. + # E.g. "v0.5.31" -> "0.5.31" + args: latest --remove-prefix + + - name: update-chart-version-with-release-version + run: | + RELEASE_VERSION=${{ steps.get-latest-no-v-version.outputs.output }} + sed -i 's//'"$RELEASE_VERSION"'/g' ./deploy/ydb-operator/Chart.yaml + + - name: create-tag + uses: mathieudutour/github-tag-action@v6.2 + with: + tag_prefix: "" + custom_tag: ${{ steps.get-latest-version.outputs.output }} + github_token: ${{ github.token }} + - name: install-dependencies run: | HELM_PKG="helm-v3.10.3-linux-amd64.tar.gz" @@ -96,3 +112,22 @@ jobs: aws s3 --endpoint-url=https://storage.yandexcloud.net \ cp ./charts/index.yaml s3://charts.ydb.tech/index.yaml + + - name: add-dockerhub-info-to-release + run: | + echo "\nDocker image has been uploaded to:\n" >> .changes/${{ steps.get-latest-version.outputs.output }}.md + echo "- ydbplatform/ydb-kubernetes-operator:${{ steps.get-latest-no-v-version.outputs.output }} on Dockerhub" >> .changes/${{ steps.get-latest-version.outputs.output }}.md + echo "- cr.yandex/yc/ydb-kubernetes-operator:${{ steps.get-latest-no-v-version.outputs.output }} on YDB public registry" >> .changes/${{ steps.get-latest-version.outputs.output }}.md + with: + body_path: .changes/${{ steps.get-latest-version.outputs.output }}.md + tag_name: ${{ steps.get-latest-version.outputs.output }} + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: create-github-release + uses: softprops/action-gh-release@v1 + with: + body_path: .changes/${{ steps.get-latest-version.outputs.output }}.md + tag_name: ${{ steps.get-latest-version.outputs.output }} + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..004c0c1b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + + +## v0.5.31 - 2024-11-04 +### Added +* Initialized a changelog diff --git a/deploy/ydb-operator/Chart.yaml b/deploy/ydb-operator/Chart.yaml index 5bea41d9..2a722414 100644 --- a/deploy/ydb-operator/Chart.yaml +++ b/deploy/ydb-operator/Chart.yaml @@ -15,10 +15,10 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.5.30 +version: "" # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.5.30" +appVersion: ""