Skip to content

Commit

Permalink
Create version.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
eskopp committed Jan 23, 2025
1 parent e3a9e7b commit 7b5b665
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/version.yml
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

0 comments on commit 7b5b665

Please # to comment.