From efcd437db16989f6556031316b86272ffe0e4c93 Mon Sep 17 00:00:00 2001 From: Victor Hang Date: Thu, 19 Dec 2024 23:09:14 +0100 Subject: [PATCH] =?UTF-8?q?feat=20=E2=9C=A8:=20add=20updatecli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Victor Hang --- .github/{workflows => }/build-anya.yaml | 0 .github/{workflows => }/build-nishinoya.yaml | 0 .github/{workflows => }/build-totoro.yaml | 0 .github/workflows/updatecli-ci.yaml | 28 +++++++++++ updatecli/updatecli.d/nixpkgs.yaml | 51 ++++++++++++++++++++ updatecli/values.yaml | 5 ++ 6 files changed, 84 insertions(+) rename .github/{workflows => }/build-anya.yaml (100%) rename .github/{workflows => }/build-nishinoya.yaml (100%) rename .github/{workflows => }/build-totoro.yaml (100%) create mode 100644 .github/workflows/updatecli-ci.yaml create mode 100644 updatecli/updatecli.d/nixpkgs.yaml create mode 100644 updatecli/values.yaml diff --git a/.github/workflows/build-anya.yaml b/.github/build-anya.yaml similarity index 100% rename from .github/workflows/build-anya.yaml rename to .github/build-anya.yaml diff --git a/.github/workflows/build-nishinoya.yaml b/.github/build-nishinoya.yaml similarity index 100% rename from .github/workflows/build-nishinoya.yaml rename to .github/build-nishinoya.yaml diff --git a/.github/workflows/build-totoro.yaml b/.github/build-totoro.yaml similarity index 100% rename from .github/workflows/build-totoro.yaml rename to .github/build-totoro.yaml diff --git a/.github/workflows/updatecli-ci.yaml b/.github/workflows/updatecli-ci.yaml new file mode 100644 index 0000000..d984d13 --- /dev/null +++ b/.github/workflows/updatecli-ci.yaml @@ -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 }}' diff --git a/updatecli/updatecli.d/nixpkgs.yaml b/updatecli/updatecli.d/nixpkgs.yaml new file mode 100644 index 0000000..965be8e --- /dev/null +++ b/updatecli/updatecli.d/nixpkgs.yaml @@ -0,0 +1,51 @@ +# manifest.yaml +name: QuickStart example +# 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 +scms: + nixpkgs: + kind: 'github' + spec: + user: 'user' + email: 'updatecli@didactiklabs.io' + owner: 'didactiklabs' + repository: 'nixbook' + token: '{{ requiredEnv "UPDATECLI_GITHUB_TOKEN" }}' + username: 'bot' + branch: 'main' +# 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' diff --git a/updatecli/values.yaml b/updatecli/values.yaml new file mode 100644 index 0000000..3df043c --- /dev/null +++ b/updatecli/values.yaml @@ -0,0 +1,5 @@ +github: + user: 'GitHub Actions Bot' + email: 'bots@didactiklabs.io' + username: 'didactik-bot' + token: 'UPDATECLI_GITHUB_TOKEN'