diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..e65240a --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,31 @@ +name: Update the version + +on: + workflow_dispatch: + schedule: + - cron: '39 0/6 * * *' +jobs: + update: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v2 + - uses: DeterminateSystems/nix-installer-action@v4 + - uses: DeterminateSystems/magic-nix-cache-action@v2 + - run: nix-shell update.sh + id: update + - if: ${{ steps.update.outputs.changed }} + uses: tibdex/github-app-token@36464acb844fc53b9b8b2401da68844f6b05ebb0 + id: generate-token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + - if: ${{ steps.update.outputs.changed }} + name: Create Pull Request + uses: peter-evans/create-pull-request@d9d6fd980e1e0904e8e4dce3f0992640091bde37 + with: + title: "Update package to ${{ steps.update.outputs.version }}" + body: '' + delete-branch: true + token: ${{ steps.generate-token.outputs.token }} + base: main diff --git a/update.sh b/update.sh index a3ff803..0e80f7d 100755 --- a/update.sh +++ b/update.sh @@ -18,3 +18,12 @@ curl -L https://github.com/openhab/openhab-distro/releases/download/"$MOST_RECEN | cut -d" " -f1 \ | tr -d '\n' \ > openhab-addons.sha256 + +if ! git diff --quiet "version"; then + if [[ -v GITHUB_OUTPUT ]]; then + echo "version=$MOST_RECENT" >> $GITHUB_OUTPUT + echo "changed=true" >> $GITHUB_OUTPUT + fi +else + exit 0 +fi diff --git a/version b/version index cc868b6..e69de29 100644 --- a/version +++ b/version @@ -1 +0,0 @@ -4.0.1 \ No newline at end of file