Skip to content

Commit

Permalink
automation: automatic updates or Rust version (#87)
Browse files Browse the repository at this point in the history
* automation: automatic updates or Rust version

Use updatecli to automatically detect updates of Rust to be done inside
of `rust-toolchain.toml`.

Neither dependabot nor renovatebot can handle that.

Signed-off-by: Flavio Castelli <[email protected]>

* fix: updatecli manifest

Signed-off-by: Olivier Vernin <[email protected]>

---------

Signed-off-by: Flavio Castelli <[email protected]>
Signed-off-by: Olivier Vernin <[email protected]>
Co-authored-by: Olivier Vernin <[email protected]>
  • Loading branch information
flavio and olblak authored Jul 11, 2024
1 parent 4bfab87 commit 98bd6f7
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/update-rust-toolchain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Update rust-toolchain

on:
workflow_dispatch:
schedule:
- cron: "30 3 * * 1" # 3:30 on Monday

jobs:
update-rust-toolchain:
name: Update Rust toolchain
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Install Updatecli in the runner
uses: updatecli/updatecli-action@fa41baa922561b436c449de1a0bd1f5bd768248c # v2.58.0

- name: Update rust version inside of rust-toolchain file
id: update_rust_toolchain
env:
UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPDATECLI_GITHUB_OWNER: ${{ github.repository_owner }}
run: |-
updatecli apply --config ./updatecli/updatecli.d/update-rust-toolchain.yaml \
--values updatecli/values.yaml
6 changes: 6 additions & 0 deletions updatecli/DEVELOP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To test the updatecli manifests locally:

```console
export UPDATECLI_GITHUB_TOKEN=<your token>
UPDATECLI_GITHUB_OWNER=<your user> updatecli diff --config updatecli/updatecli.d/update-rust-toolchain.yaml --values updatecli/values.yaml
```
44 changes: 44 additions & 0 deletions updatecli/updatecli.d/update-rust-toolchain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Update Rust version inside of rust-toolchain file

scms:
github:
kind: github
spec:
user: "{{ .github.author }}"
email: "{{ .github.email }}"
owner: "{{ requiredEnv .github.owner }}"
repository: "wapc-rs"
token: "{{ requiredEnv .github.token }}"
username: "{{ requiredEnv .github.user }}"
branch: "{{ .github.branch }}"
commitmessage:
hidecredit: true

sources:
rust-lang:
name: Get the latest release of Rust from rust-lang
kind: githubrelease
spec:
owner: rust-lang
repository: rust
token: "{{ requiredEnv .github.token }}"
versionfilter:
kind: semver
pattern: "*"

targets:
dataFile:
name: 'deps(rust): update Rust version to {{ source "rust-lang" }}'
kind: toml
scmid: github
spec:
file: "rust-toolchain.toml"
key: toolchain.channel

actions:
default:
kind: github/pullrequest
scmid: github
spec:
labels:
- chore
7 changes: 7 additions & 0 deletions updatecli/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
github:
owner: "UPDATECLI_GITHUB_OWNER"
token: "UPDATECLI_GITHUB_TOKEN"
branch: "master"
author: "updatecli bot"
email: "[email protected]"
user: "UPDATECLI_GITHUB_OWNER"

0 comments on commit 98bd6f7

Please sign in to comment.