Skip to content

Commit

Permalink
Refactor workflows
Browse files Browse the repository at this point in the history
Signed-off-by: hossainemruz <[email protected]>
  • Loading branch information
hossainemruz committed Dec 8, 2023
1 parent 5cc8b03 commit 9861a93
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 78 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/lighthouse-check.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/md-link-check.yaml

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: PR Workflows

# Run action on pull request event
on: [pull_request]


jobs:
# Build exampleSite
build:
runs-on: ubuntu-latest
steps:
# checkout to the commit that has been pushed
- uses: actions/[email protected]

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install node modules
run: npm install

- name: Setup Hugo
uses: peaceiris/[email protected]
with:
hugo-version: 'latest'
extended: true

- name: Build
run: |
hugo --minify
lighthouse-check:
runs-on: ubuntu-latest
steps:
- name: Waiting for Netlify Preview
uses: kamranayub/[email protected]
id: preview
with:
site_name: "toha-guides"
max_timeout: 300
env:
NETLIFY_TOKEN: ${{secrets.NETLIFY_TOKEN}}

- name: Run Lighthouse
uses: foo-software/[email protected]
id: lighthouseCheck
with:
accessToken: ${{ secrets.LIGHTHOUSE_TOKEN }}
gitHubAccessToken: ${{secrets.GITHUB_TOKEN}}
emulatedFormFactor: 'all'
prCommentEnabled: true
prCommentSaveOld: false
timeout: 5
urls: "${{ steps.preview.outputs.url }},${{ steps.preview.outputs.url }}/posts/,${{ steps.preview.outputs.url }}/posts/markdown-sample/,${{ steps.preview.outputs.url }}/posts/shortcodes/"

# Check for any broken links
markdown-link-check:
runs-on: ubuntu-latest
steps:
# checkout to latest commit
- uses: actions/checkout@master

- name: Waiting for Netlify Preview
uses: kamranayub/[email protected]
id: preview
with:
site_name: "toha-guides"
max_timeout: 300
env:
NETLIFY_TOKEN: ${{secrets.NETLIFY_TOKEN}}

- name: Link Checker
id: lychee
uses: lycheeverse/[email protected]
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
args: "--verbose --exclude-mail ${{steps.preview.outputs.url}} --exclude=['https://www.udemy.com/']"
output: lychee/out.md

- name: Comment Broken Links
if: ${{ steps.lychee.outputs.exit_code != 0 }}
uses: marocchino/sticky-pull-request-comment@v2
with:
path: lychee/out.md

- name: Fail workflow if broken links found
if: ${{ steps.lychee.outputs.exit_code != 0 }}
run: exit 1
52 changes: 52 additions & 0 deletions .github/workflows/theme-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Theme Update"

on:
schedule:
- cron: "0 0 * * *"

jobs:
update-theme:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
ref: main

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Setup Hugo
uses: peaceiris/[email protected]
with:
hugo-version: "latest"
extended: true

- name: Update hugo modules
run: |
# update to latest version of all modules
hugo mod get -u
# update the npm dependencies
hugo mod npm pack
# cleanup go.sum file
hugo mod tidy
- name: Install node modules
run: npm install

- name: Build
run: |
# build the site
hugo --minify
# remove file generated by the build
rm -rf public/
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
base: main
title: Update theme
labels: automerge
2 changes: 1 addition & 1 deletion assets/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"baseUrl": ".",
"paths": {
"*": [
"../../../../../.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/hugo-toha/toha/[email protected]-20230929231747-c943f39617c1/assets/*"
"../../../../../.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/hugo-toha/toha/[email protected]/assets/*"
]
}
}
Expand Down
6 changes: 3 additions & 3 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ params:
# Show/hide newsletter section in the footer. Default is "true".
# Currently, it supports "mailchimp".
newsletter:
enable: true
provider: mailchimp
mailchimpURL: https://github.us1.list-manage.com/subscribe/post?u=19de52a4603135aae97163fd8&amp;id=094a24c76e
enable: false
# provider: mailchimp
# mailchimpURL: https://github.us1.list-manage.com/subscribe/post?u=19de52a4603135aae97163fd8&amp;id=094a24c76e

# Show/hide disclaimer notice in the footer. Default is "false".
disclaimer:
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ go 1.19
// replace github.com/hugo-toha/toha/v3 => ../toha

require (
github.com/hugo-toha/toha/v4 v4.0.0-20231031071528-05c9d3d850b2 // indirect
github.com/hugofy/hugofy v0.0.0-20230215174605-0af4f57bf558 // indirect
github.com/hugo-toha/toha/v4 v4.0.0 // indirect
)
12 changes: 2 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
github.com/hugo-toha/toha/v4 v4.0.0-20230728200917-0e12222cc3bd h1:cSPVhSQLd3CI+QnVl/tpMSKJm50+nYJL/qtAYrUdNkE=
github.com/hugo-toha/toha/v4 v4.0.0-20230728200917-0e12222cc3bd/go.mod h1:p/K34lqlqmhzfPd4cx66od7sjlROBqhMxG30mJz+aKQ=
github.com/hugo-toha/toha/v4 v4.0.0-20230929231747-c943f39617c1 h1:iPPEerrlIaBH5TvkQSQ71Rg09C5GvGVodM0WOiipUcc=
github.com/hugo-toha/toha/v4 v4.0.0-20230929231747-c943f39617c1/go.mod h1:p/K34lqlqmhzfPd4cx66od7sjlROBqhMxG30mJz+aKQ=
github.com/hugo-toha/toha/v4 v4.0.0-20231030042714-e61d6b796b48 h1:/3ICPbsN9zTOmIQqSmzVdMCShucO22LgZyPIQhd4yBg=
github.com/hugo-toha/toha/v4 v4.0.0-20231030042714-e61d6b796b48/go.mod h1:p/K34lqlqmhzfPd4cx66od7sjlROBqhMxG30mJz+aKQ=
github.com/hugo-toha/toha/v4 v4.0.0-20231031071528-05c9d3d850b2 h1:EkR94Ztv1Ao+iEP0e5Vk/GRmZvhAjSHzjsMOXBaK3Ak=
github.com/hugo-toha/toha/v4 v4.0.0-20231031071528-05c9d3d850b2/go.mod h1:p/K34lqlqmhzfPd4cx66od7sjlROBqhMxG30mJz+aKQ=
github.com/hugofy/hugofy v0.0.0-20230215174605-0af4f57bf558 h1:x3Ey1ITCOjhFaCUjubPRAhTTYQw2+g27NuQMqdq8xR8=
github.com/hugofy/hugofy v0.0.0-20230215174605-0af4f57bf558/go.mod h1:5g0QdEPA4ThSe+v5ZGKLfPwrfqiz2mq8mAB8HXI0Trw=
github.com/hugo-toha/toha/v4 v4.0.0 h1:rOiQeXzppzBLslTcQ1q2cqtz4KrjvYsrEVAHClbnsU8=
github.com/hugo-toha/toha/v4 v4.0.0/go.mod h1:p/K34lqlqmhzfPd4cx66od7sjlROBqhMxG30mJz+aKQ=

0 comments on commit 9861a93

Please sign in to comment.