Commit on repository instead of PR

This commit is contained in:
SebClem 2024-09-10 13:48:02 +02:00
parent 43367602d9
commit 4d7be08b8c
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50

View File

@ -4,7 +4,7 @@ on:
push: push:
branches: branches:
- "*" - "*"
tags: tags:
- "*" - "*"
pull_request: pull_request:
@ -89,7 +89,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
arch: [ aarch64, amd64, armv7 ] arch: [aarch64, amd64, armv7]
include: include:
- arch: aarch64 - arch: aarch64
arch_value: linux/arm64/v8 arch_value: linux/arm64/v8
@ -120,19 +120,19 @@ jobs:
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: | images: |
${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}} ${{env.REPOSITORY}}/${{env.IMAGE}}/${{matrix.arch}}
tags: | tags: |
type=ref,event=branch type=ref,event=branch
type=ref,event=branch,suffix=.${{ github.run_number }} type=ref,event=branch,suffix=.${{ github.run_number }}
type=ref,event=pr type=ref,event=pr
type=semver,pattern={{version}} type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}
labels: | labels: |
io.hass.name=${{env.NAME}} io.hass.name=${{env.NAME}}
io.hass.description=${{env.DESCRIPTION}} io.hass.description=${{env.DESCRIPTION}}
io.hass.url=${{env.URL}} io.hass.url=${{env.URL}}
io.hass.arch=${{matrix.arch}} io.hass.arch=${{matrix.arch}}
io.hass.type=addon io.hass.type=addon
- name: Debug Env - name: Debug Env
run: | run: |
@ -165,19 +165,19 @@ jobs:
update_main_ha_repository: update_main_ha_repository:
name: Update HA addon repository name: Update HA addon repository
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- build-dockers - build-dockers
if: ${{ github.ref == 'refs/heads/main' }} if: ${{ github.ref == 'refs/heads/main' }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
path: "addon" path: "addon"
- name: Checkout Hass repo - name: Checkout Hass repo
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: Sebclem/sebclem-hassio-addon-repository repository: Sebclem/sebclem-hassio-addon-repository
path: "repository" path: "repository"
- name: Get branch names - name: Get branch names
id: branch-names id: branch-names
@ -185,7 +185,7 @@ jobs:
- name: Generate readme - name: Generate readme
uses: cuchi/jinja2-action@v1.2.2 uses: cuchi/jinja2-action@v1.2.2
with: with:
template: addon/nextcloud_backup/.README.md.j2 template: addon/nextcloud_backup/.README.md.j2
output_file: repository/nextcloud_backup/README.md output_file: repository/nextcloud_backup/README.md
variables: version=${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number}} variables: version=${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number}}
@ -196,30 +196,28 @@ jobs:
cp addon/nextcloud_backup/icon.png 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/logo.png repository/nextcloud_backup/
cp addon/nextcloud_backup/config.yml repository/nextcloud_backup/ cp addon/nextcloud_backup/config.yml repository/nextcloud_backup/
- name: Change version in config file - name: Change version in config file
uses: fjogeleit/yaml-update-action@main uses: fjogeleit/yaml-update-action@V0.15.0
with: with:
valueFile: 'repository/nextcloud_backup/config.yml' valueFile: "repository/nextcloud_backup/config.yml"
propertyPath: 'version' propertyPath: "version"
value: ${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number}} value: ${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number}}
commitChange: false commitChange: false
- name: Add image propertie - name: Add image propertie
uses: fjogeleit/yaml-update-action@main uses: fjogeleit/yaml-update-action@V0.15.0
with: with:
valueFile: 'repository/nextcloud_backup/config.yml' valueFile: "repository/nextcloud_backup/config.yml"
propertyPath: 'image' propertyPath: "image"
value: "ghcr.io/sebclem/hassio-nextcloud-backup/{arch}" value: "ghcr.io/sebclem/hassio-nextcloud-backup/{arch}"
commitChange: false commitChange: false
- name: Create pull request - name: Commit and push
uses: peter-evans/create-pull-request@v6 uses: actions-js/push@v1.5
with: with:
token: ${{ secrets.PAT_PR }} github_token: ${{ secrets.PAT_PR }}
path: "repository" directory: "repository"
commit-message: "Update Nextcloud Backup to ${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number }}" message: "Update Nextcloud Backup to ${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number }}"
branch: "update/bextcloud_backup/${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number }}" branch: "${{ steps.branch-names.outputs.current_branch }}"
base: "${{ steps.branch-names.outputs.current_branch }}" repository: "Sebclem/sebclem-hassio-addon-repository"
title: "Update Nextcloud Backup to ${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number }}"