Skip to content

Commit

Permalink
Release/feature/241005-workflow (#43)
Browse files Browse the repository at this point in the history
* chore: Setup-go@v5

* feat: Run lint and open PR auto

* feat: Add status badge into the header

* fix: Rename markdownlint to lint

* fix: Syntax error

* feat: create-pull-request -> gh pr create

* feat: temporarily disable lint

* feat: Add status badge for page-build-deployment

* fix: GH_TOKEN for release workflow

* fix: Attach body for gh pr

---------

Co-authored-by: Atsuya Watanabe <[email protected]>
  • Loading branch information
github-actions[bot] and atsuyaw authored Oct 22, 2024
1 parent d6de8ae commit 50870f1
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 12 deletions.
9 changes: 9 additions & 0 deletions .github/.yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

extends: default

rules:
line-length:
level: warning
document-start: disable

20 changes: 8 additions & 12 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
name: GitHub Pages
name: Deploy GitHub Pages

on:
push:
branches:
- main # Set a branch to deploy
pull_request:
workflow_dispatch:
"on": [push, workflow_dispatch]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '^1.20'
go-version: 'stable'

- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Lint

"on":
push:
branches: ["Notting"]
# branches-ignore:
# - main
# tags:
# - "*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
markdownlint:
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Run markdownlint-cli2-action@v17
uses: DavidAnson/markdownlint-cli2-action@v17
with:
fix: true
globs: '**/*.md'
continue-on-error: true
- name: Run create-pull-request
uses: peter-evans/create-pull-request@v7
with:
author: >-
github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
commit-message: "fix: Lint suggestions"
branch: "patch/${{ github.ref_name }}"
title: "fix: Lint suggestions for ${{ github.ref_name }}"
yamllint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run yamllint-github-action
uses: karancode/[email protected]
with:
yamllint_file_or_dir: .github/workflows/
yamllint_config_filepath: .github/.yamllint
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

"on":
push:
branches-ignore:
- main
tags:
- "*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
openPR:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Create PR
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr create \
--base "main" \
--head "${{ github.ref_name }}" \
--title "Release/${{ github.ref_name }}" \
--body "GitHub actions" \
82 changes: 82 additions & 0 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{{ if and .Site.Params.permanentTopNav .Site.Params.stickyNav }}
<header class="sticky">
{{ else }}
<header>
{{ end }}
<a id="back-to-top-button">
<i class="fas fa-angle-up"></i>
</a>

<div class="container">
<div class="logo">
<a href="{{ .Site.BaseURL | relLangURL }}" class="logo">
{{ if and (isset .Site.Params "customimage") (ne .Site.Params.customImage "") }}
<img src="{{ .Site.Params.customImage | relURL }}" alt="">
{{ else }}
{{ $avatarEmail := "" }}
{{ if not (eq .Site.Params.avatarEmail nil) }}
{{ $avatarEmail = .Site.Params.avatarEmail }}
{{ else }}
{{ $avatarEmail = .Site.Params.gravatarEMail }}
{{ end }}
<img src="https://seccdn.libravatar.org/avatar/{{ md5 $avatarEmail }}?d=mm&size=200" alt="">
{{ end }}

<span class="overlay"><i class="fa {{ .Site.Params.overlayIcon | default "fa-home" }}"></i></span>
</a>
</div>
<div class="titles">
<h3 class="title">
<a href="{{ .Site.BaseURL | relLangURL }}">
{{ .Site.Title | default "My cool new blog" }}
</a>
</h3>

{{ with .Site.Params.Subtitle }}
<span class="subtitle">{{ . }}</span>
{{ end }}
<p style="margin-top: .5rem">
<a href="https://github.com/atsuyaw/atsuyaw.github.io/actions/workflows/gh-pages.yml">
<img src="https://github.com/atsuyaw/atsuyaw.github.io/actions/workflows/gh-pages.yml/badge.svg" alt="Status on Deployment of GitHub Pages">
</a>
<a href="https://github.com/atsuyaw/atsuyaw.github.io/actions/workflows/pages/pages-build-deployment">
<img src="https://github.com/atsuyaw/atsuyaw.github.io/actions/workflows/pages/pages-build-deployment/badge.svg" alt="pages-build-deployment">
</a>
</p>
</div>
<div class="selectors">
{{ if .Site.Params.enableLightDarkTheme | default false }}
<div class="light-dark-mode">
<button id="light-dark-toggle" class="fa-solid fa-sun"></button>
</div>
{{ end }}
{{ if and (gt .Site.Languages 1) (.Site.Params.showHeaderLanguageChooser | default true) }}
{{- $language := .Language -}}
{{- $pages := .Page.AllTranslations -}}
<div class="languages">
{{ range $.Site.Home.AllTranslations }}
{{ $url := .RelPermalink }}
{{ range where $pages "Lang" .Language.Lang }}
{{ $url = .RelPermalink }}
{{ end }}

{{ if eq $language .Language }}
<a href="{{ $url }}" class="active">{{ .Language }}</a>
{{ else }}
<a href="{{ $url }}">{{ .Language }}</a>
{{ end }}
{{ end }}
</div>
{{ end }}
</div>

{{ if .Site.Params.permanentTopNav }}
<div class="toggler permanentTopNav">
{{ else }}
<div class="toggler">
{{ end }}
<i class="fa fa-bars" aria-hidden="true"></i>
</div>
</div>
</div>
</header>

0 comments on commit 50870f1

Please sign in to comment.