Merge pull request #3 from eskopp/dependabot/github_actions/eskopp/gi… #18
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
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@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "latest" | |
- 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: Install Hugo Extended | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: "latest" | |
extended: true | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "${{ steps.go-version.outputs.go_version }}" | |
- name: Update | |
run: | | |
go get -u ./... | |
go mod edit -go="${{ steps.go-version.outputs.go_version }}" | |
go mod tidy | |
npm update | |
hugo mod get github.com/gethinode/mod-flexsearch | |
hugo mod get github.com/imfing/hextra | |
- name: Commit and Push Changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_GITHUB }} | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
git add go.mod | |
git add go.sum | |
git commit -m "Update Hugo modules and Go version [skip ci]" || echo "No changes to commit" | |
git push |