Skip to content

Commit

Permalink
feat: add updateli to handle dependency (#25)
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Vernin <[email protected]>
  • Loading branch information
olblak committed Apr 22, 2024
1 parent 5889030 commit 4b08d51
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/updatecli.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 }}
35 changes: 35 additions & 0 deletions update-compose.yaml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions updatecli/values.d/golang_major.yaml
Original file line number Diff line number Diff line change
@@ -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"

18 changes: 18 additions & 0 deletions updatecli/values.d/golang_minor.yaml
Original file line number Diff line number Diff line change
@@ -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"

17 changes: 17 additions & 0 deletions updatecli/values.d/golang_patch.yaml
Original file line number Diff line number Diff line change
@@ -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"

8 changes: 8 additions & 0 deletions updatecli/values.d/scm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
scm:
enabled: true
user: updatecli
email: [email protected]
owner: updatecli
repository: releasepost
username: "updatecli-bot"
branch: main
3 changes: 3 additions & 0 deletions updatecli/values.d/update-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spec:
files:
- "update-compose.yaml"

0 comments on commit 4b08d51

Please sign in to comment.