From eef0bbf78a48d67cd706f509b67baa137c7f219d Mon Sep 17 00:00:00 2001 From: SebClem Date: Mon, 26 Aug 2024 16:06:32 +0200 Subject: [PATCH] Fix build number not the same --- .github/workflows/build_addon.yml | 54 ++++++++++++++++++++++ .github/workflows/update_repository.yml | 60 ------------------------- 2 files changed, 54 insertions(+), 60 deletions(-) delete mode 100644 .github/workflows/update_repository.yml diff --git a/.github/workflows/build_addon.yml b/.github/workflows/build_addon.yml index bb43788..7628f68 100644 --- a/.github/workflows/build_addon.yml +++ b/.github/workflows/build_addon.yml @@ -158,3 +158,57 @@ jobs: cache-to: type=inline context: ./${{env.TARGET}}/ platforms: ${{ matrix.arch_value }} + + publish-main: + name: Publish main + runs-on: ubuntu-latest + needs: + - build-dockers + if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }} + 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_number}} + + - 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_number}} + 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_number }}" + branch: "update/bextcloud_backup/${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number }}" + base: "${{ steps.branch-names.outputs.current_branch }}" + title: "Update Nextcloud Backup to ${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number }}" + \ No newline at end of file diff --git a/.github/workflows/update_repository.yml b/.github/workflows/update_repository.yml deleted file mode 100644 index 72c3e12..0000000 --- a/.github/workflows/update_repository.yml +++ /dev/null @@ -1,60 +0,0 @@ -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_number}} - 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_number }}" - branch: "update/bextcloud_backup/${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number }}" - base: "${{ steps.branch-names.outputs.current_branch }}" - title: "Update Nextcloud Backup to ${{ steps.branch-names.outputs.current_branch }}.${{ github.run_number }}"