diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 17cd33f..1c7eed3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -4,6 +4,8 @@ on: push: branches: - master + paths-ignore: + - "_contrib/**" env: RUST_BACKTRACE: 1 diff --git a/.github/workflows/contrib.yml b/.github/workflows/contrib.yml new file mode 100644 index 0000000..73f2620 --- /dev/null +++ b/.github/workflows/contrib.yml @@ -0,0 +1,97 @@ +name: contrib +on: + schedule: + - cron: '15 3 * * *' + workflow_dispatch: + +permissions: + contents: write # to update _contrib + pull-requests: write # to send the updated _contrib PRs + +jobs: + update-contrib: + name: Update _contrib + runs-on: ubuntu-latest + + steps: + - name: Checkout website + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Checkout hyper + uses: actions/checkout@v3 + with: + persist-credentials: false + repository: hyperium/hyper + path: hyper + + - name: Copy CONTRIBUTING.md into docs + run: | + sed -i -e 's|./docs/||g' hyper/CONTRIBUTING.md + cp -a hyper/CONTRIBUTING.md hyper/docs + + # Insert frontmatter borders, replace markdown header with + # frontmatter title and insert layout: guide + - name: Convert doc titles to frontmatter + run: | + for f in hyper/docs/*.md; do + sed -i -e '1i ---' \ + -e '1s/#/title:/' \ + -e '2i layout: guide' \ + -e '2i ---' $f; + done + + # Use the hyper docs readme as the index page of contrib, + # and insert permalink: /contrib/ in the frontmatter + - name: Convert readme to index + run: | + sed -i -e '4i permalink: /contrib/' hyper/docs/README.md + mv hyper/docs/README.md hyper/docs/index.md + + # Lowercase the internal links so they will correctly point to + # the lowercased filenames. + - name: Lowercase internal links + run: | + for filename in hyper/docs/*.md; do + # cut `.md` from the filename before search and replace + filename=${filename::-3}; + + for file in hyper/docs/*.md; do + # don't lowercase MSRV + if [[ "${filename##*/}" == 'MSRV' ]]; then + continue + fi + + # match instances of only the filename, not including + # the parent path, and convert them to lowercase + sed -i -e "s|${filename##*/}|\L\0|g" $file; + done + done + + - name: Lowercase filenames and replace underscores + run: | + for f in hyper/docs/*; do + mv -vn "$f" "$(echo "$f" | tr '[:upper:]' '[:lower:]' | tr '_' '-')"; + done + + - name: Copy docs to contrib + run: | + mkdir -p _contrib + cp -a hyper/docs/. _contrib/ + + - uses: gr2m/create-or-update-pull-request-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + author: github-actions + branch: actions/update-contrib + title: 'doc: update contrib docs' + body: > + The _contrib docs are likely out of date. This is an automatically + generated PR by the `contrib.yml` GitHub workflow, which clones the docs + from the main repo, implements the changes in _contrib then submits a new + PR or updates an existing PR. + commit-message: 'doc: update contrib docs' + path: _contrib/ + diff --git a/_config.yml b/_config.yml index d0d83e2..d494421 100644 --- a/_config.yml +++ b/_config.yml @@ -11,12 +11,17 @@ defaults: values: layout: "guide" - - scope: path: "_stable/" type: "guides" values: layout: "guide" + - + scope: + path: "_contrib/" + type: "guides" + values: + layout: "guide" collections: @@ -29,6 +34,9 @@ collections: posts: permalink: /blog/:year/:month/:day/:title/ output: true + contrib: + permalink: /contrib/:path/ + output: true # Build settings markdown: kramdown diff --git a/_contrib/code-of-conduct.md b/_contrib/code-of-conduct.md new file mode 100644 index 0000000..09955a1 --- /dev/null +++ b/_contrib/code-of-conduct.md @@ -0,0 +1,24 @@ +--- +title: Code of Conduct +layout: guide +--- + +## Be Kind + +- Don't be mean. +- Insulting anyone is prohibited. +- Harassment of any kind is prohibited. +- If another person feels uncomfortable with your remarks, stop it. +- If a moderator deems your comment or conduct as inappropriate, stop it. +- Disagreeing is fine, but keep it to technical arguments. Never attack the person. +- Give the benefit of the doubt. Assume good intentions. +- Show empathy. There are 3 interpretations to any message: what we thought, what we said, and what they understand. +- This does mean we exclude people who are not kind. We are happy to make that sacrifice. + +## Or Else + +- Violations of the Code of Conduct will result in 1 warning. +- If the violation is major, a moderator may just ban immediately. +- If a warning has already been given, a moderator will ban the offender. +- There is no process for appealing a ban. +- Any violations can be reported to sean@seanmonstar.com. diff --git a/_contrib/commits.md b/_contrib/commits.md new file mode 100644 index 0000000..67aabe3 --- /dev/null +++ b/_contrib/commits.md @@ -0,0 +1,68 @@ +--- +title: Git Commit Guidelines +layout: guide +--- + +We have very precise rules over how our git commit messages can be formatted. This leads to **more +readable messages** that are easy to follow when looking through the **project history**. But also, +we use the git commit messages to **generate the change log**. + +## Commit Message Format +Each commit message consists of a **header**, a **body** and a **footer**. The header has a special +format that includes a **type**, a **scope** and a **subject**: + +``` +(): + + + +