From af398edbc59c4fc0f1cf15b7aefd46aee1602aa6 Mon Sep 17 00:00:00 2001 From: SebClem Date: Mon, 26 Aug 2024 15:48:56 +0200 Subject: [PATCH] Try auto update via github action --- .github/workflows/build_addon.yml | 1 - .github/workflows/update_repository.yml | 60 +++++++++++++++++++ .../{.README.ejs => .README.md.j2} | 6 +- nextcloud_backup/config.json | 39 ------------ nextcloud_backup/config.yml | 32 ++++++++++ 5 files changed, 95 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/update_repository.yml rename nextcloud_backup/{.README.ejs => .README.md.j2} (92%) delete mode 100644 nextcloud_backup/config.json create mode 100644 nextcloud_backup/config.yml diff --git a/.github/workflows/build_addon.yml b/.github/workflows/build_addon.yml index 9eb934b..b403efd 100644 --- a/.github/workflows/build_addon.yml +++ b/.github/workflows/build_addon.yml @@ -97,7 +97,6 @@ jobs: arch_value: linux/arm/v7 steps: - - uses: actions/checkout@v4 - name: Set up QEMU diff --git a/.github/workflows/update_repository.yml b/.github/workflows/update_repository.yml new file mode 100644 index 0000000..a43bc13 --- /dev/null +++ b/.github/workflows/update_repository.yml @@ -0,0 +1,60 @@ +name: Update repository + +on: + release: + types: [published] + push: + branches: main + workflow_dispatch: + + +jobs: + publish-main: + name: Publish main + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + path: "addon" + - name: Checkout Hass repo + uses: actions/checkout@v4 + with: + repository: Sebclem/sebclem-hassio-addon-repository + path: "repository" + + - name: Get branch names + id: branch-names + uses: tj-actions/branch-names@v8 + + - name: Generate readme + uses: cuchi/jinja2-action@v1.2.2 + with: + template: addon/nextcloud_backup/.README.md.j2 + output_file: repository/nextcloud_backup/README.md + variables: version=${{ steps.branch-names.outputs.current_branch }}.${{ github.run_id}} + + - name: Move other files + run: | + cp addon/nextcloud_backup/Docs.md repository/nextcloud_backup/ + cp addon/nextcloud_backup/icon.png repository/nextcloud_backup/ + cp addon/nextcloud_backup/logo.png repository/nextcloud_backup/ + cp addon/nextcloud_backup/config.yml repository/nextcloud_backup/ + + - name: Change version in config file + uses: fjogeleit/yaml-update-action@main + with: + valueFile: 'repository/nextcloud_backup/config.yml' + propertyPath: 'version' + value: ${{ steps.branch-names.outputs.current_branch }}.${{ github.run_id}} + commitChange: false + + - name: Create pull request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.PAT_PR }} + path: "repository" + commit-message: "Update Nextcloud Backup to ${{ steps.branch-names.outputs.current_branch }}.${{ github.run_id}}" + branch: "update/Nextcloud Backup/${{ steps.branch-names.outputs.current_branch }}.${{ github.run_id}}" + base: "${{ steps.branch-names.outputs.current_branch }}" + title: "Update Nextcloud Backup to ${{ steps.branch-names.outputs.current_branch }}.${{ github.run_id}}" diff --git a/nextcloud_backup/.README.ejs b/nextcloud_backup/.README.md.j2 similarity index 92% rename from nextcloud_backup/.README.ejs rename to nextcloud_backup/.README.md.j2 index 54ab37a..33c2746 100644 --- a/nextcloud_backup/.README.ejs +++ b/nextcloud_backup/.README.md.j2 @@ -27,9 +27,9 @@ Easily backup your Home Assistant snapshots to Nextcloud. [docs]: https://github.com/Sebclem/hassio-nextcloud-backup/blob/master/README.md [forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg [forum]: https://community.home-assistant.io/ -[maintenance-shield]: https://img.shields.io/maintenance/yes/2022.svg +[maintenance-shield]: https://img.shields.io/maintenance/yes/2024.svg [project-stage-shield]: https://img.shields.io/badge/project%20stage-beta-red.svg -[release-shield]: https://img.shields.io/badge/version-<%= version %>-blue.svg -[release]: https://img.shields.io/badge/version-<%= version %>-blue.svg +[release-shield]: https://img.shields.io/badge/version-{{ version }}-blue.svg +[release]: https://img.shields.io/badge/version-{{ version }}-blue.svg [image]: https://github.com/Sebclem/hassio-nextcloud-backup/raw/master/images/screenshot.png [logo]: https://github.com/Sebclem/hassio-nextcloud-backup/raw/master/nextcloud_backup/logo.png diff --git a/nextcloud_backup/config.json b/nextcloud_backup/config.json deleted file mode 100644 index 9f7b1a5..0000000 --- a/nextcloud_backup/config.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "Nextcloud Backup", - "version": "dev", - "slug": "nextcloud_backup", - "description": "Easily upload your Home Assistant backups to Nextcloud", - "url": "https://github.com/Sebclem/hassio-nextcloud-backup", - "webui": "[PROTO:ssl]://[HOST]:[PORT:3000]/", - "ingress": true, - "ingress_port": 3000, - "panel_icon": "mdi:cloud-upload", - "panel_title": "NC Backup", - "panel_admin": true, - "startup": "application", - "stage": "experimental", - "init": false, - "arch": [ - "aarch64", - "amd64", - "armv7" - ], - "boot": "auto", - "hassio_api": true, - "hassio_role": "admin", - "homeassistant_api": true, - "options": { - "log_level": "info", - "create_backup_timeout": 5400000 - }, - "schema": { - "log_level": "list(trace|debug|info|notice|warning|error|fatal)", - "create_backup_timeout": "int" - }, - "ports": { - "3000/tcp": null - }, - "ports_description": { - "3000/tcp": "Web interface (Not required for Home Assistant Ingress)" - } -} diff --git a/nextcloud_backup/config.yml b/nextcloud_backup/config.yml new file mode 100644 index 0000000..6516970 --- /dev/null +++ b/nextcloud_backup/config.yml @@ -0,0 +1,32 @@ +name: Nextcloud Backup +version: dev +slug: nextcloud_backup +description: Easily upload your Home Assistant backups to Nextcloud +url: https://github.com/Sebclem/hassio-nextcloud-backup +webui: "[PROTO:ssl]://[HOST]:[PORT:3000]/" +ingress: true +ingress_port: 3000 +panel_icon: mdi:cloud-upload +panel_title: NC Backup +panel_admin: true +startup: application +stage: experimental +init: false +arch: + - aarch64 + - amd64 + - armv7 +boot: auto +hassio_api: true +hassio_role: admin +homeassistant_api: true +options: + log_level: info + create_backup_timeout: 5400000 +schema: + log_level: list(trace|debug|info|notice|warning|error|fatal) + create_backup_timeout: int +ports: + 3000/tcp: null +ports_description: + 3000/tcp: Web interface (Not required for Home Assistant Ingress)