-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Weekly Hugo Update | ||
|
||
on: | ||
push: # Trigger on every push | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update-code: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get Latest Go Version | ||
id: go-version | ||
run: | | ||
LATEST_GO_VERSION=$(curl -s "https://go.dev/VERSION?m=text" | sed 's/^go//') | ||
echo "::set-output name=go_version::$LATEST_GO_VERSION" | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "${{ steps.go-version.outputs.go_version }}" | ||
|
||
- name: Install Hugo Extended | ||
uses: peaceiris/actions-hugo@v3 | ||
with: | ||
hugo-version: "latest" | ||
extended: true | ||
|
||
- name: Update Go Version in go.mod | ||
run: | | ||
go mod edit -go="${{ steps.go-version.outputs.go_version }}" | ||
- name: Fetch Hugo Modules | ||
run: | | ||
hugo mod get | ||
- name: Commit and Push Changes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "actions@github.com" | ||
git add go.mod go.sum | ||
git commit -m "Update Hugo modules and Go version [skip ci]" || echo "No changes to commit" | ||
git push |