hassio-nextcloud-backup/.github/workflows/update_repository.yml

61 lines
2.1 KiB
YAML

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}}"