Skip to content

Commit

Permalink
feat ✨: add updatecli
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Hang <[email protected]>
  • Loading branch information
Banh-Canh committed Dec 19, 2024
1 parent be19ef1 commit cdae6da
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions .github/workflows/updatecli-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Updatecli
on:
pull_request:
pull_request_target:
types: [opened, synchronize, reopened, edited]
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
permissions:
contents: 'write'
pull-requests: 'write'
jobs:
updatecli:
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Updatecli in the runner
uses: updatecli/updatecli-action@v2
- name: Run Updatecli in Dry Run mode
run: 'updatecli diff --config ./updatecli/updatecli.d --values updatecli/values.yaml'
env:
UPDATECLI_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- name: Run Updatecli in apply mode
run: 'updatecli apply --config ./updatecli/updatecli.d --values updatecli/values.yaml'
env:
UPDATECLI_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
51 changes: 51 additions & 0 deletions updatecli/updatecli.d/nixpkgs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# manifest.yaml
name: QuickStart example
scms:
nixpkgs:
kind: 'github'
spec:
user: 'user'
email: '[email protected]'
owner: 'didactiklabs'
repository: 'nixbook'
token: '{{ requiredEnv "UPDATECLI_GITHUB_TOKEN" }}'
username: 'github-actions'
branch: 'main'
# Defines how to get "source" information such as Jenkins version
sources:
default:
scmid: 'nixpkgs'
name: Get value from json
kind: json
spec:
file: npins/sources.json
key: .pins.nixpkgs.revision
# Defines "conditions" required to update targets
conditions:
default:
scmid: 'nixpkgs'
kind: shell
spec:
environments:
- name: PATH
command: echo $(git ls-remote https://github.com/NixOS/nixpkgs nixos-24.11 | awk '{print $1}') ==
# Defines "targets" which need to be updated if different than "source" information.
targets:
default:
name: NpinsUpdate
kind: shell
scmid: 'nixpkgs'
spec:
environments:
- name: PATH
command: npins update nixpkgs && echo
# Define action configurations if one needs to be created
actions:
nixpkgs:
kind: 'github/pullrequest'
scmid: 'nixpkgs'
spec:
automerge: false
description: 'Prepend description'
draft: false
title: 'Pull Request Title'
5 changes: 5 additions & 0 deletions updatecli/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
github:
user: 'GitHub Actions Bot'
email: '[email protected]'
username: 'didactik-bot'
token: 'UPDATECLI_GITHUB_TOKEN'

0 comments on commit cdae6da

Please sign in to comment.