new action for auto update

This commit is contained in:
Nuno Coração 2024-03-09 21:26:04 +00:00
parent ae1e413884
commit a63d69060c
2 changed files with 46 additions and 35 deletions

View file

@ -1,43 +1,53 @@
name: Update Hugo version name: Update Hugo version
on: on:
schedule: schedule:
- cron: '60 1 * * *' - cron: '0 6 * * *'
workflow_dispatch: workflow_dispatch:
jobs: jobs:
updateBlowfish: updateBlowfish:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2
with: - name: Check out code into the Go module directory
token: ${{ secrets.REPO_SCOPED_TOKEN }} uses: actions/checkout@v4
- name: Fetch release version with:
run: | submodules: true # Fetch Hugo themes (true OR recursive)
curl -sL https://api.github.com/repos/swagger-api/swagger-ui/releases/latest | \ fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
jq -r ".tag_name" > release-versions/swagger-ui-latest.txt
- name: Check for modified files - name: Fetch release version
id: git-check id: fetch-release
run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true") run: |
- name: Commit latest release version curl -sL https://api.github.com/repos/gohugoio/hugo/releases/latest | \
if: steps.git-check.outputs.modified == 'true' jq -r ".tag_name" > release-versions/hugo-latest.txt
run: |
git config --global user.name 'Your Name' - name: Check for modified files
git config --global user.email 'your-email@users.noreply.github.com' id: git-check
git commit -am "New release version" run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")
git push
- name: Create Pull Request - name: Update config.toml
uses: peter-evans/create-pull-request@v6 id: update-config
with: if: steps.git-check.outputs.modified == 'true'
commit-message: Update swagger-ui to ${{ steps.swagger-ui.outputs.release_tag }} run: |
title: Update SwaggerUI to ${{ steps.swagger-ui.outputs.release_tag }} cat release-versions/hugo-latest.txt | \
body: | while read version; do sed -i '' -E "s/(max = \")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${version#v}\2/g" config.toml |
Updates [swagger-ui][1] to ${{ steps.swagger-ui.outputs.release_tag }} 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] Auto-generated by [create-pull-request][2]
[1]: https://github.com/swagger-api/swagger-ui [1]: https://github.com/gohugoio/hugo
[2]: https://github.com/peter-evans/create-pull-request [2]: https://github.com/peter-evans/create-pull-request
labels: dependencies, automated pr labels: dependencies, automated pr
branch: dev branch: dev

View file

@ -0,0 +1 @@
v0.123.1