From 50870f158271322ebca1c5a705d263c8d23514bb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:07:07 +0900 Subject: [PATCH] Release/feature/241005-workflow (#43) * 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 --- .github/.yamllint | 9 ++++ .github/workflows/gh-pages.yml | 20 ++++----- .github/workflows/lint.yml | 46 +++++++++++++++++++ .github/workflows/release.yml | 27 +++++++++++ layouts/partials/header.html | 82 ++++++++++++++++++++++++++++++++++ 5 files changed, 172 insertions(+), 12 deletions(-) create mode 100644 .github/.yamllint create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/release.yml create mode 100644 layouts/partials/header.html diff --git a/.github/.yamllint b/.github/.yamllint new file mode 100644 index 00000000..20d627ee --- /dev/null +++ b/.github/.yamllint @@ -0,0 +1,9 @@ +--- + +extends: default + +rules: + line-length: + level: warning + document-start: disable + diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index b26cd72a..90ca1be7 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,18 +1,14 @@ -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: @@ -20,9 +16,9 @@ jobs: 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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..3f858416 --- /dev/null +++ b/.github/workflows/lint.yml @@ -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/yamllint-github-action@v2.0.0 + with: + yamllint_file_or_dir: .github/workflows/ + yamllint_config_filepath: .github/.yamllint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..69542d4e --- /dev/null +++ b/.github/workflows/release.yml @@ -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" \ diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 00000000..5fcddad4 --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,82 @@ +{{ if and .Site.Params.permanentTopNav .Site.Params.stickyNav }} +
+{{ else }} +
+{{ end }} + + + + +
+ +
+

+ + {{ .Site.Title | default "My cool new blog" }} + +

+ + {{ with .Site.Params.Subtitle }} + {{ . }} + {{ end }} +

+ + Status on Deployment of GitHub Pages + + + pages-build-deployment + +

+
+
+ {{ if .Site.Params.enableLightDarkTheme | default false }} +
+ +
+ {{ end }} + {{ if and (gt .Site.Languages 1) (.Site.Params.showHeaderLanguageChooser | default true) }} + {{- $language := .Language -}} + {{- $pages := .Page.AllTranslations -}} +
+ {{ range $.Site.Home.AllTranslations }} + {{ $url := .RelPermalink }} + {{ range where $pages "Lang" .Language.Lang }} + {{ $url = .RelPermalink }} + {{ end }} + + {{ if eq $language .Language }} + {{ .Language }} + {{ else }} + {{ .Language }} + {{ end }} + {{ end }} +
+ {{ end }} +
+ + {{ if .Site.Params.permanentTopNav }} +
+ {{ else }} +
+ {{ end }} + +
+
+
+