diff --git a/.github/workflows/readme-versions.yml b/.github/workflows/readme-versions.yml new file mode 100644 index 0000000..954d826 --- /dev/null +++ b/.github/workflows/readme-versions.yml @@ -0,0 +1,80 @@ +name: README Versions + +on: + pull_request: + types: [opened, reopened, synchronize] + branches: [main] + paths: + - Dockerfile + +jobs: + readme: + name: Update README versions + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout PR + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ github.event.pull_request.head.ref }} + + - name: Parse Caddy version + id: caddy + shell: bash + run: | + CADDY_VERSION=$(grep -m 1 -Eo 'caddy:[0-9]+\.[0-9]+\.[0-9]+' Dockerfile \ + | sed -E 's/.+:([0-9]+\.[0-9]+\.[0-9]+)(.+)?$/\1/g') + MAJOR=$(echo "$CADDY_VERSION" | cut -d . -f 1) + MINOR=$(echo "$CADDY_VERSION" | cut -d . -f 2) + PATCH=$(echo "$CADDY_VERSION" | cut -d . -f 3) + cat < tags.md <"{p=0;print;next} + $1==""{system("cat tags.md");p=1} + p + ' README.md > README.md.new + mv README.md.new README.md + rm tags.md + + - name: Check if README was updated + id: changed + shell: bash + run: | + if git diff-index --quiet HEAD ; then + echo "changed=false" | tee -a "$GITHUB_OUTPUT" + else + echo "changed=true" | tee -a "$GITHUB_OUTPUT" + fi + + - name: Push changes back to PR + if: steps.changed.outputs.changed == 'true' + uses: ChromeQ/commit@99a563633526aeb2d5c2b02b1521accee9a8c896 # v2.x + env: + GH_TOKEN: ${{ github.token }} + with: + ref: ${{ github.event.pull_request.head.ref }} + commit-message: "docs: Updating README for v${{ steps.caddy.outputs.version }}" + files: | + README.md diff --git a/README.md b/README.md index 63b2598..e9226c0 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,19 @@ docker pull ghcr.io/iarekylew00t/caddy-cloudflare:latest ## Tags -The following tags are available for the `iarekylew00t/caddy-cloudflare` image. - -- `latest` -- `` (eg: `2.6.4`, including: `2.6`, `2`, etc.) - -Check the GitHub [Tags](https://github.com/IAreKyleW00t/docker-caddy-cloudflare/tags) -for a full list of supported versions! +The following tags are the latest available for the +`iarekylew00t/caddy-cloudflare` image. + + +- [`latest`](https://github.com/IAreKyleW00t/docker-caddy-cloudflare/tree/v2.8.4) +- [`2.8.4`](https://github.com/IAreKyleW00t/docker-caddy-cloudflare/tree/v2.8.4) +- [`2.8`](https://github.com/IAreKyleW00t/docker-caddy-cloudflare/tree/v2.8) +- [`2`](https://github.com/IAreKyleW00t/docker-caddy-cloudflare/tree/v2) + + +Check the GitHub +[Tags](https://github.com/IAreKyleW00t/docker-caddy-cloudflare/tags) +for a list of all versions! ## Usage