diff --git a/.github/workflows/updatecli.yaml b/.github/workflows/updatecli.yaml new file mode 100644 index 0000000..bab4183 --- /dev/null +++ b/.github/workflows/updatecli.yaml @@ -0,0 +1,47 @@ +name: updatecli +on: + release: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + # Run every hour + - cron: "0 * * * *" + +permissions: {} + +jobs: + updatecli: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + - name: "Setup updatecli" + uses: "updatecli/updatecli-action@v2" + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + id: go + - name: "Run updatecli in dryrun" + run: "updatecli compose diff" + env: + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: tibdex/github-app-token@v2.1 + id: generate_token + if: github.ref == 'refs/heads/main' + with: + app_id: ${{ secrets.UPDATECLIBOT_APP_ID }} + private_key: ${{ secrets.UPDATECLIBOT_APP_PRIVKEY }} + - name: "Run updatecli" + if: github.ref == 'refs/heads/main' + run: "updatecli compose apply" + env: + GITHUB_ACTOR: ${{ secrets.UPDATECLI_BOT_GITHUB_ACTOR }} + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} diff --git a/update-compose.yaml b/update-compose.yaml new file mode 100644 index 0000000..34c9673 --- /dev/null +++ b/update-compose.yaml @@ -0,0 +1,35 @@ +policies: + + - name: Update Updatecli policies + policy: ghcr.io/updatecli/policies/updatecli/autodiscovery:0.2.0@sha256:46e599fb7e874ee3f1c9cf5e4dd64b328a15d61d03e106176b19a07683afde29 + values: + - updatecli/values.d/scm.yaml + - updatecli/values.d/update-compose.yaml + + - name: Golang Version + policy: ghcr.io/updatecli/policies/golang/version:0.1.0 + values: + - updatecli/values.d/scm.yaml + + - name: Major Golang Module update + policy: ghcr.io/updatecli/policies/autodiscovery/golang:0.6.0 + values: + - updatecli/values.d/scm.yaml + - updatecli/values.d/golang_major.yaml + + - name: Minor Golang Module update + policy: ghcr.io/updatecli/policies/autodiscovery/golang:0.6.0 + values: + - updatecli/values.d/scm.yaml + - updatecli/values.d/golang_minor.yaml + + - name: Patch Golang Module update + policy: ghcr.io/updatecli/policies/autodiscovery/golang:0.6.0 + values: + - updatecli/values.d/scm.yaml + - updatecli/values.d/golang_patch.yaml + + - name: Update golangci-lint + policy: ghcr.io/updatecli/policies/golangci-lint/githubaction:0.1.0 + values: + - updatecli/values.d/scm.yaml diff --git a/updatecli/values.d/golang_major.yaml b/updatecli/values.d/golang_major.yaml new file mode 100644 index 0000000..edd2b25 --- /dev/null +++ b/updatecli/values.d/golang_major.yaml @@ -0,0 +1,18 @@ +name: "deps(golang): Bump Major version for Golang module" +pipelineid: "golang/gomod/major" +groupby: all + +spec: + versionfilter: + kind: semver + pattern: majoronly + ignore: + - modules: + # Ignoring the following modules as they do not publish release + github.com/shurcooL/githubv4: "" + + only: + # This repository contains other go.sum file used for testing. + # So we want to be sure that we only update the one at the root of the repository + - path: "go.mod" + diff --git a/updatecli/values.d/golang_minor.yaml b/updatecli/values.d/golang_minor.yaml new file mode 100644 index 0000000..809408d --- /dev/null +++ b/updatecli/values.d/golang_minor.yaml @@ -0,0 +1,18 @@ +name: "deps(golang): Bump Minor version for Golang module" +pipelineid: "golang/gomod/minor" +groupby: individual + +spec: + versionfilter: + kind: semver + pattern: minoronly + ignore: + - modules: + # Ignoring the following modules as they do not publish release + github.com/shurcooL/githubv4: "" + + only: + # This repository contains other go.sum file used for testing. + # So we want to be sure that we only update the one at the root of the repository + - path: "go.mod" + diff --git a/updatecli/values.d/golang_patch.yaml b/updatecli/values.d/golang_patch.yaml new file mode 100644 index 0000000..3cd1639 --- /dev/null +++ b/updatecli/values.d/golang_patch.yaml @@ -0,0 +1,17 @@ +name: "deps: bump patch version for Golang module" +pipelineid: "golang/gomod/patch" + +spec: + versionfilter: + kind: semver + pattern: patch + ignore: + - modules: + # Ignoring the following modules as they do not publish release + github.com/shurcooL/githubv4: "" + + only: + # This repository contains other go.sum file used for testing. + # So we want to be sure that we only update the one at the root of the repository + - path: "go.mod" + diff --git a/updatecli/values.d/scm.yaml b/updatecli/values.d/scm.yaml new file mode 100644 index 0000000..30e6183 --- /dev/null +++ b/updatecli/values.d/scm.yaml @@ -0,0 +1,8 @@ +scm: + enabled: true + user: updatecli + email: bot@updatecli.io + owner: updatecli + repository: releasepost + username: "updatecli-bot" + branch: main diff --git a/updatecli/values.d/update-compose.yaml b/updatecli/values.d/update-compose.yaml new file mode 100644 index 0000000..4aa3243 --- /dev/null +++ b/updatecli/values.d/update-compose.yaml @@ -0,0 +1,3 @@ +spec: + files: + - "update-compose.yaml"