From f5ac4604f14815d3163a58bf15d1e8665d4c2908 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Fri, 27 Sep 2024 22:57:39 -0400 Subject: [PATCH] feat: update workflows to include master branch --- .github/workflows/buf-publish.yml | 2 +- .github/workflows/docker-release.yml | 6 ++---- .github/workflows/pr-merged.yml | 29 -------------------------- .github/workflows/run-goreleaser.yml | 6 +++--- .github/workflows/sync-branches.yml | 24 --------------------- .github/workflows/unit-test.yml | 26 ----------------------- .github/workflows/version-bump.yml | 31 ++++++++++++++++++++++++++++ 7 files changed, 37 insertions(+), 87 deletions(-) delete mode 100644 .github/workflows/pr-merged.yml delete mode 100644 .github/workflows/sync-branches.yml delete mode 100644 .github/workflows/unit-test.yml create mode 100644 .github/workflows/version-bump.yml diff --git a/.github/workflows/buf-publish.yml b/.github/workflows/buf-publish.yml index 929f6a08a..732a315cf 100644 --- a/.github/workflows/buf-publish.yml +++ b/.github/workflows/buf-publish.yml @@ -2,8 +2,8 @@ name: Publish to buf.build/didao/sonr on: push: branches: - - master - develop + - master permissions: contents: write diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 2eb7efda5..cc3b980e6 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -1,11 +1,9 @@ name: Publish Docker Image -# NOTE: For this action to work, you must enable write permissions in your github repository settings. -# Settings -> Actions -> General. "Workflow Permissions". Select "Read and write permissions". -# If you forget to enable, the action will fail on push with a 401 error. Just re-run the failed action after enabling. - on: push: + branches: + - master tags: - "v[0-9]+.[0-9]+.[0-9]+" # ignore rc diff --git a/.github/workflows/pr-merged.yml b/.github/workflows/pr-merged.yml deleted file mode 100644 index 07ccc0a85..000000000 --- a/.github/workflows/pr-merged.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: PR Merged - Bump Version and Tag - -on: - pull_request: - types: - - closed - branches: - - develop - -permissions: - contents: write - -jobs: - bump-version-and-tag: - if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'feature/') - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Bump version and update changelog - uses: commitizen-tools/commitizen-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Push changes and tag - run: git push && git push --tags diff --git a/.github/workflows/run-goreleaser.yml b/.github/workflows/run-goreleaser.yml index 505959065..d84e40771 100644 --- a/.github/workflows/run-goreleaser.yml +++ b/.github/workflows/run-goreleaser.yml @@ -18,13 +18,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" - name: Clean up dist directory run: rm -rf dist diff --git a/.github/workflows/sync-branches.yml b/.github/workflows/sync-branches.yml deleted file mode 100644 index 99cff56fb..000000000 --- a/.github/workflows/sync-branches.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Gitflow Sync -on: - # To create pull requests. - push: - # To merge pull requests if not possible during the push run. Remove if `auto-merge` is `false`. - pull_request_review: - check_run: - types: [completed] - -permissions: - contents: read - pull-requests: write - -jobs: - build: - name: Gitflow - runs-on: ubuntu-latest - steps: - - uses: Logerfo/gitflow-action@0.0.5 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} # The `GITHUB_TOKEN` secret. - dev: develop - master: master - release: release diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml deleted file mode 100644 index edfbe567f..000000000 --- a/.github/workflows/unit-test.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Unit tests -on: - push: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - GO_VERSION: 1.22 - -jobs: - tests: - runs-on: ubuntu-latest - steps: - - name: Check out source - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: ${{ env.GO_VERSION }} - check-latest: true - - - name: Tests - run: make test diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml new file mode 100644 index 000000000..0ded41bb7 --- /dev/null +++ b/.github/workflows/version-bump.yml @@ -0,0 +1,31 @@ +name: Bump version + +on: + push: + branches: + - master + +jobs: + bump-version: + if: "!startsWith(github.event.head_commit.message, 'bump:')" + runs-on: ubuntu-latest + name: "Bump version and create changelog with commitizen" + steps: + - name: Check out + uses: actions/checkout@v4 + with: + token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" + fetch-depth: 0 + + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + check-latest: true + + - name: Tests + run: make test + + - name: Create bump and changelog + uses: commitizen-tools/commitizen-action@master + with: + github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}