From 8d3e4df0111ac15bd9d344a8edeb6651098ec34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 9 Mar 2024 21:30:18 +0000 Subject: [PATCH 01/10] new action for auto update --- .github/workflows/hugo-version-update.yml | 53 +++++++++++++++++++++++ release-versions/hugo-latest.txt | 1 + 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/hugo-version-update.yml create mode 100644 release-versions/hugo-latest.txt diff --git a/.github/workflows/hugo-version-update.yml b/.github/workflows/hugo-version-update.yml new file mode 100644 index 00000000..60481b31 --- /dev/null +++ b/.github/workflows/hugo-version-update.yml @@ -0,0 +1,53 @@ +name: Update Hugo version + +on: + schedule: + - cron: '0 6 * * *' + + workflow_dispatch: + +jobs: + updateBlowfish: + runs-on: ubuntu-latest + steps: + + - name: Check out code into the Go module directory + uses: actions/checkout@v4 + with: + submodules: true # Fetch Hugo themes (true OR recursive) + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + + - name: Fetch release version + id: fetch-release + run: | + curl -sL https://api.github.com/repos/gohugoio/hugo/releases/latest | \ + jq -r ".tag_name" > release-versions/hugo-latest.txt + + - name: Check for modified files + id: git-check + run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true") + + - name: Update config.toml + id: update-config + if: steps.git-check.outputs.modified == 'true' + run: | + cat release-versions/hugo-latest.txt | \ + while read version; do sed -i '' -E "s/(max = \")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${version#v}\2/g" config.toml | + release_tag=$(cat release-versions/hugo-latest.txt) | \ + echo "release_tag=$release_tag" >> $GITHUB_OUTPUT + + - name: Create Pull Request + if: steps.git-check.outputs.modified == 'true' + uses: peter-evans/create-pull-request@v6 + with: + commit-message: Update Hugo supported version to ${{ steps.update-config.outputs.release_tag }} + title: Update Hugo supported version to ${{ steps.update-config.outputs.release_tag }} + body: | + Updates [Hugo][1] support to ${{ steps.update-config.outputs.release_tag }} + + Auto-generated by [create-pull-request][2] + + [1]: https://github.com/gohugoio/hugo + [2]: https://github.com/peter-evans/create-pull-request + labels: dependencies, automated pr + branch: dev \ No newline at end of file diff --git a/release-versions/hugo-latest.txt b/release-versions/hugo-latest.txt new file mode 100644 index 00000000..3510a4a6 --- /dev/null +++ b/release-versions/hugo-latest.txt @@ -0,0 +1 @@ +v0.123.7 From 2134b2fd01a50c190c2c0b69d22a4fec96bf2b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 9 Mar 2024 21:37:03 +0000 Subject: [PATCH 02/10] Update hugo-version-update.yml --- .github/workflows/hugo-version-update.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/hugo-version-update.yml b/.github/workflows/hugo-version-update.yml index 60481b31..d3c008ac 100644 --- a/.github/workflows/hugo-version-update.yml +++ b/.github/workflows/hugo-version-update.yml @@ -32,7 +32,7 @@ jobs: if: steps.git-check.outputs.modified == 'true' run: | cat release-versions/hugo-latest.txt | \ - while read version; do sed -i '' -E "s/(max = \")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${version#v}\2/g" config.toml | + while read version; do sed -i '' -E "s/(max = \")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${version#v}\2/g" config.toml | \ release_tag=$(cat release-versions/hugo-latest.txt) | \ echo "release_tag=$release_tag" >> $GITHUB_OUTPUT @@ -50,4 +50,4 @@ jobs: [1]: https://github.com/gohugoio/hugo [2]: https://github.com/peter-evans/create-pull-request labels: dependencies, automated pr - branch: dev \ No newline at end of file + branch: dev From 83b0c5aea07c01922ecd71a6b8ca09258ed8b425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 9 Mar 2024 21:39:44 +0000 Subject: [PATCH 03/10] Update hugo-version-update.yml --- .github/workflows/hugo-version-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hugo-version-update.yml b/.github/workflows/hugo-version-update.yml index d3c008ac..19ae430a 100644 --- a/.github/workflows/hugo-version-update.yml +++ b/.github/workflows/hugo-version-update.yml @@ -32,7 +32,7 @@ jobs: if: steps.git-check.outputs.modified == 'true' run: | cat release-versions/hugo-latest.txt | \ - while read version; do sed -i '' -E "s/(max = \")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${version#v}\2/g" config.toml | \ + while read version; do sed -i '' -E "s/(max = \")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${version#v}\2/g" config.toml; done | \ release_tag=$(cat release-versions/hugo-latest.txt) | \ echo "release_tag=$release_tag" >> $GITHUB_OUTPUT From f4022f5a5c24f8dad6fa4871237ff8ffcaa5b75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 9 Mar 2024 21:43:57 +0000 Subject: [PATCH 04/10] Update hugo-version-update.yml --- .github/workflows/hugo-version-update.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hugo-version-update.yml b/.github/workflows/hugo-version-update.yml index 19ae430a..54c2c8da 100644 --- a/.github/workflows/hugo-version-update.yml +++ b/.github/workflows/hugo-version-update.yml @@ -50,4 +50,5 @@ jobs: [1]: https://github.com/gohugoio/hugo [2]: https://github.com/peter-evans/create-pull-request labels: dependencies, automated pr - branch: dev + branch: hugo-new-version + base: dev From 5fdf429761a757d78c920e86bac4348a01203425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 9 Mar 2024 21:49:51 +0000 Subject: [PATCH 05/10] Update hugo-version-update.yml --- .github/workflows/hugo-version-update.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/hugo-version-update.yml b/.github/workflows/hugo-version-update.yml index 54c2c8da..1b9e1ab4 100644 --- a/.github/workflows/hugo-version-update.yml +++ b/.github/workflows/hugo-version-update.yml @@ -14,6 +14,7 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v4 with: + ref: 'dev' submodules: true # Fetch Hugo themes (true OR recursive) fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod From 937fdad583f79a6ae023305e33415f748e16cc68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 9 Mar 2024 21:50:36 +0000 Subject: [PATCH 06/10] Update hugo-version-update.yml --- .github/workflows/hugo-version-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hugo-version-update.yml b/.github/workflows/hugo-version-update.yml index 1b9e1ab4..91b850d7 100644 --- a/.github/workflows/hugo-version-update.yml +++ b/.github/workflows/hugo-version-update.yml @@ -42,7 +42,7 @@ jobs: uses: peter-evans/create-pull-request@v6 with: commit-message: Update Hugo supported version to ${{ steps.update-config.outputs.release_tag }} - title: Update Hugo supported version to ${{ steps.update-config.outputs.release_tag }} + title: :gear: Update Hugo supported version to ${{ steps.update-config.outputs.release_tag }} body: | Updates [Hugo][1] support to ${{ steps.update-config.outputs.release_tag }} From 83797461b4859ee828d8657cba32e14429a0ff0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 9 Mar 2024 21:51:35 +0000 Subject: [PATCH 07/10] Update hugo-version-update.yml --- .github/workflows/hugo-version-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hugo-version-update.yml b/.github/workflows/hugo-version-update.yml index 91b850d7..a865fed4 100644 --- a/.github/workflows/hugo-version-update.yml +++ b/.github/workflows/hugo-version-update.yml @@ -14,7 +14,7 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v4 with: - ref: 'dev' + ref: dev submodules: true # Fetch Hugo themes (true OR recursive) fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod From 0c22317171606fce45626d4b629271f5c9dc38fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 9 Mar 2024 21:53:47 +0000 Subject: [PATCH 08/10] Update hugo-version-update.yml --- .github/workflows/hugo-version-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hugo-version-update.yml b/.github/workflows/hugo-version-update.yml index a865fed4..4617c4b1 100644 --- a/.github/workflows/hugo-version-update.yml +++ b/.github/workflows/hugo-version-update.yml @@ -42,7 +42,7 @@ jobs: uses: peter-evans/create-pull-request@v6 with: commit-message: Update Hugo supported version to ${{ steps.update-config.outputs.release_tag }} - title: :gear: Update Hugo supported version to ${{ steps.update-config.outputs.release_tag }} + title: ⚙️ Update Hugo supported version to ${{ steps.update-config.outputs.release_tag }} body: | Updates [Hugo][1] support to ${{ steps.update-config.outputs.release_tag }} From afdaaaf40858965981c009c90beb233afabf29c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 9 Mar 2024 21:58:46 +0000 Subject: [PATCH 09/10] Update hugo-version-update.yml --- .github/workflows/hugo-version-update.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/hugo-version-update.yml b/.github/workflows/hugo-version-update.yml index 4617c4b1..fc86f313 100644 --- a/.github/workflows/hugo-version-update.yml +++ b/.github/workflows/hugo-version-update.yml @@ -33,18 +33,16 @@ jobs: if: steps.git-check.outputs.modified == 'true' run: | cat release-versions/hugo-latest.txt | \ - while read version; do sed -i '' -E "s/(max = \")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${version#v}\2/g" config.toml; done | \ - release_tag=$(cat release-versions/hugo-latest.txt) | \ - echo "release_tag=$release_tag" >> $GITHUB_OUTPUT + while read version; do sed -i '' -E "s/(max = \")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${version#v}\2/g" config.toml; done - name: Create Pull Request if: steps.git-check.outputs.modified == 'true' uses: peter-evans/create-pull-request@v6 with: - commit-message: Update Hugo supported version to ${{ steps.update-config.outputs.release_tag }} - title: ⚙️ Update Hugo supported version to ${{ steps.update-config.outputs.release_tag }} + commit-message: Update Hugo supported version + title: ⚙️ Update Hugo supported version body: | - Updates [Hugo][1] support to ${{ steps.update-config.outputs.release_tag }} + Updates [Hugo][1] support Auto-generated by [create-pull-request][2] From 36d022e020b6898fd4d0df9b173dad842ba7a2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 9 Mar 2024 22:03:16 +0000 Subject: [PATCH 10/10] Update hugo-version-update.yml --- .github/workflows/hugo-version-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hugo-version-update.yml b/.github/workflows/hugo-version-update.yml index fc86f313..b1982d8d 100644 --- a/.github/workflows/hugo-version-update.yml +++ b/.github/workflows/hugo-version-update.yml @@ -33,7 +33,7 @@ jobs: if: steps.git-check.outputs.modified == 'true' run: | cat release-versions/hugo-latest.txt | \ - while read version; do sed -i '' -E "s/(max = \")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${version#v}\2/g" config.toml; done + while read version; do sed -i'' -E "s/(max = \")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${version#v}\2/g" config.toml; done - name: Create Pull Request if: steps.git-check.outputs.modified == 'true'