Skip to content

Commit 5a6c417

Browse files
authored
feat(actions): rework updates of themes and hugo version (#55)
Remove renovate as it doesn't seem to work when the repo itself is not one of the packages (like maven) it expected it to be. So revert back to using a simple shell workflow to update hugo version.
1 parent cd12025 commit 5a6c417

File tree

4 files changed

+87
-109
lines changed

4 files changed

+87
-109
lines changed

.github/renovate.json

-42
This file was deleted.

.github/workflows/do-updates.yaml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
name: Do updates
3+
"on":
4+
schedule:
5+
- cron: '0 7 * * 1' # At 07:00 on Monday
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
update_themes:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: true
20+
21+
- name: Update submodules
22+
run: |
23+
git submodule update --recursive
24+
25+
- name: Create Pull Request
26+
uses: peter-evans/create-pull-request@v5
27+
env:
28+
bot_name: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
29+
with:
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
branch: chore/themes/update-sub-modules
32+
delete-branch: true
33+
reviewers: beiertu-mms
34+
committer: ${{ env.bot_name }}
35+
author: ${{ env.bot_name }}
36+
commit-message: 'chore(themes): update sub-modules'
37+
title: 'chore(themes): update sub-modules'
38+
labels: dependencies
39+
body: |
40+
Update the [themes](https://github.com/beiertu-mms/beiertu-mms.github.io/tree/master/themes) submodules.
41+
42+
update_hugo:
43+
runs-on: ubuntu-latest
44+
env:
45+
file: .github/workflows/publish.yaml
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
50+
- name: Update Hugo
51+
id: versions
52+
run: |
53+
set -o pipefail
54+
CURRENT=$(yq -r '.jobs.build.env[]' ${{ env.file }})
55+
echo "Current version of Hugo in publish.yaml is $CURRENT"
56+
LATEST=$(curl -s -H "Accept: application/vnd.github+json" \
57+
"https://api.github.com/repos/gohugoio/hugo/releases/latest" \
58+
| jq -r '.tag_name')
59+
LATEST_SEMVER="${LATEST#v}"
60+
echo "Latest version of Hugo is $LATEST_SEMVER"
61+
sed -i "s/HUGO_VERSION:.*/HUGO_VERSION: $LATEST_SEMVER/" "${{ env.file }}"
62+
git diff
63+
{
64+
echo "current=$CURRENT"
65+
echo "latest=$LATEST_SEMVER"
66+
} >> "$GITHUB_OUTPUT"
67+
68+
- name: Create Pull Request
69+
uses: peter-evans/create-pull-request@v5
70+
env:
71+
bot_name: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
72+
message: "chore(action): bump hugo from ${{ steps.versions.outputs.current }} to ${{ steps.versions.outputs.latest }}"
73+
hugo_url: https://github.com/gohugoio/hugo
74+
with:
75+
token: ${{ secrets.PAT }} # to be able to update a workflow
76+
branch: chore/action/update-hugo-version
77+
delete-branch: true
78+
committer: ${{ env.bot_name }}
79+
author: ${{ env.bot_name }}
80+
commit-message: ${{ env.message }}
81+
title: ${{ env.message }}
82+
labels: dependencies
83+
body: |
84+
Bump [Hugo](${{ env.hugo_url }}) from ${{ steps.versions.outputs.current }} to ${{ steps.versions.outputs.latest }}
85+
---
86+
Release: ${{ env.hugo_url }}/releases/tag/v${{ steps.versions.outputs.latest }}
87+
Changelog: ${{ env.hugo_url }}/compare/v${{ steps.versions.outputs.current }}...v${{ steps.versions.outputs.latest }}

.github/workflows/run-renovate.yaml

-28
This file was deleted.

.github/workflows/update-themes.yaml

-39
This file was deleted.

0 commit comments

Comments
 (0)