From 5add4ecc5c262f6b8283e31afcbe191482590c9b Mon Sep 17 00:00:00 2001 From: Jean-Christian Paul Denis Date: Thu, 26 Dec 2024 21:15:48 +0100 Subject: [PATCH] Create bump_dcLog.yml --- .github/workflows/bump_dcLog.yml | 72 ++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/bump_dcLog.yml diff --git a/.github/workflows/bump_dcLog.yml b/.github/workflows/bump_dcLog.yml new file mode 100644 index 0000000..0b794ba --- /dev/null +++ b/.github/workflows/bump_dcLog.yml @@ -0,0 +1,72 @@ +name: Check plugin dcLog + +on: + schedule: + - cron: '25 23 * * *' + workflow_dispatch: + +env: + PLUGIN_NAME: dclog + PLUGIN_REPO: jcdenis/dcLog + PLUGIN_ENV: DC_DOCKER_PLUGIN_DCLOG + +jobs: + version: + name: Check versions + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + distant: ${{ steps.distant.outputs.version }} + local: ${{ steps.local.outputs.version }} + steps: + - name: Read distant version + id: repository + uses: oprypin/find-latest-tag@v1.1.2 + with: + repository: ${{ env.PLUGIN_REPO }} + prefix: 'v' + - name: Parse distant version + id: distant + run: | + version=${{ steps.repository.outputs.tag }} + echo "version=${version:1}" >> $GITHUB_OUTPUT + - name: Check out local repository + uses: actions/checkout@v4 + - name: Parse local version + id: local + run: | + version=$(sed -n "s/\s*${{ env.PLUGIN_ENV }}=\(.*\)\s\(.*\)/\1/p" ./Dockerfile) + echo "version=${version}" >> $GITHUB_OUTPUT + - name: Summary + run: | + echo '* Distant: ${{ steps.distant.outputs.version }}' >> $GITHUB_STEP_SUMMARY + echo '* Local: ${{ steps.local.outputs.version }}' >> $GITHUB_STEP_SUMMARY + + update: + needs: version + name: Update dockerfile + if: (needs.version.outputs.distant != needs.version.outputs.local) + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Set message + id: message + run: | + message=$'Bump ${{ env.PLUGIN_NAME }} from ${{ needs.version.outputs.local }} to ${{ needs.version.outputs.distant }}' + echo "message=${message}" >> $GITHUB_OUTPUT + - name: Check out the repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Edit file + run: | + sed -i "s/${{ env.PLUGIN_ENV }}=${{ needs.version.outputs.local }}/${{ env.PLUGIN_ENV }}=${{ needs.version.outputs.distant }}/g" ./Dockerfile + - name: Commit change + uses: EndBug/add-and-commit@v9.1.4 + with: + default_author: github_actions + message: ${{ steps.message.outputs.message }} + - name: summary + run: echo '* ${{ steps.message.outputs.message }}' >> $GITHUB_STEP_SUMMARY