From 06495ed9ca8666025b9794ea23de5777f9850e19 Mon Sep 17 00:00:00 2001 From: Tim Chown Date: Mon, 21 Oct 2024 10:59:37 +0100 Subject: [PATCH] Initial commit --- .github/workflows/LICENSE.md | 1 + .github/workflows/archive.yml | 42 ++++++++++++++ .github/workflows/ghpages.yml | 58 +++++++++++++++++++ .github/workflows/publish.yml | 57 +++++++++++++++++++ .github/workflows/setup.yml | 99 +++++++++++++++++++++++++++++++++ .github/workflows/update.yml | 36 ++++++++++++ README.md | 18 ++++++ draft-todo-yourname-protocol.md | 89 +++++++++++++++++++++++++++++ 8 files changed, 400 insertions(+) create mode 100644 .github/workflows/LICENSE.md create mode 100644 .github/workflows/archive.yml create mode 100644 .github/workflows/ghpages.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/setup.yml create mode 100644 .github/workflows/update.yml create mode 100644 README.md create mode 100644 draft-todo-yourname-protocol.md diff --git a/.github/workflows/LICENSE.md b/.github/workflows/LICENSE.md new file mode 100644 index 0000000..f002b82 --- /dev/null +++ b/.github/workflows/LICENSE.md @@ -0,0 +1 @@ +This project is in the public domain. diff --git a/.github/workflows/archive.yml b/.github/workflows/archive.yml new file mode 100644 index 0000000..dd9429a --- /dev/null +++ b/.github/workflows/archive.yml @@ -0,0 +1,42 @@ +name: "Archive Issues and Pull Requests" + +on: + schedule: + - cron: '0 0 * * 0,2,4' + repository_dispatch: + types: [archive] + workflow_dispatch: + inputs: + archive_full: + description: 'Recreate the archive from scratch' + default: false + type: boolean + +jobs: + build: + name: "Archive Issues and Pull Requests" + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + # Note: No caching for this build! + + - name: "Update Archive" + uses: martinthomson/i-d-template@v1 + env: + ARCHIVE_FULL: ${{ inputs.archive_full }} + with: + make: archive + token: ${{ github.token }} + + - name: "Update GitHub Pages" + uses: martinthomson/i-d-template@v1 + with: + make: gh-archive + token: ${{ github.token }} + + - name: "Save Archive" + uses: actions/upload-artifact@v4 + with: + path: archive.json diff --git a/.github/workflows/ghpages.yml b/.github/workflows/ghpages.yml new file mode 100644 index 0000000..a1bf36e --- /dev/null +++ b/.github/workflows/ghpages.yml @@ -0,0 +1,58 @@ +name: "Update Editor's Copy" + +on: + push: + paths-ignore: + - README.md + - CONTRIBUTING.md + - LICENSE.md + - .gitignore + pull_request: + paths-ignore: + - README.md + - CONTRIBUTING.md + - LICENSE.md + - .gitignore + +jobs: + build: + name: "Update Editor's Copy" + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + - name: "Setup" + id: setup + run: date -u "+date=%FT%T" >>"$GITHUB_OUTPUT" + + - name: "Caching" + uses: actions/cache@v4 + with: + path: | + .refcache + .venv + .gems + node_modules + .targets.mk + key: i-d-${{ steps.setup.outputs.date }} + restore-keys: i-d- + + - name: "Build Drafts" + uses: martinthomson/i-d-template@v1 + with: + token: ${{ github.token }} + + - name: "Update GitHub Pages" + uses: martinthomson/i-d-template@v1 + if: ${{ github.event_name == 'push' }} + with: + make: gh-pages + token: ${{ github.token }} + + - name: "Archive Built Drafts" + uses: actions/upload-artifact@v4 + with: + path: | + draft-*.html + draft-*.txt diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..94d885f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,57 @@ +name: "Publish New Draft Version" + +on: + push: + tags: + - "draft-*" + workflow_dispatch: + inputs: + email: + description: "Submitter email" + default: "" + type: string + +jobs: + build: + name: "Publish New Draft Version" + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + # See https://github.com/actions/checkout/issues/290 + - name: "Get Tag Annotations" + run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} + + - name: "Setup" + id: setup + run: date -u "+date=%FT%T" >>"$GITHUB_OUTPUT" + + - name: "Caching" + uses: actions/cache@v4 + with: + path: | + .refcache + .venv + .gems + node_modules + .targets.mk + key: i-d-${{ steps.setup.outputs.date }} + restore-keys: i-d- + + - name: "Build Drafts" + uses: martinthomson/i-d-template@v1 + with: + token: ${{ github.token }} + + - name: "Upload to Datatracker" + uses: martinthomson/i-d-template@v1 + with: + make: upload + env: + UPLOAD_EMAIL: ${{ inputs.email }} + + - name: "Archive Submitted Drafts" + uses: actions/upload-artifact@v4 + with: + path: "versioned/draft-*-[0-9][0-9].*" diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml new file mode 100644 index 0000000..60445f8 --- /dev/null +++ b/.github/workflows/setup.yml @@ -0,0 +1,99 @@ +name: "Perform Initial Repository Setup" + +on: + push: + branches: [main] + +jobs: + setup: + name: "Setup Repository" + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + - name: "Precondition Check" + id: pre + run: | + if ! ls draft-* rfc* 2>/dev/null | grep -qv draft-todo-yourname-protocol.md; then + echo "=============================================================" + echo "Skipping setup for the first commit." + echo + echo "Rename draft-todo-yourname-protocol.md to start using this repository:" + echo + echo " https://github.com/${{github.repository}}/edit/main/draft-todo-yourname-protocol.md" + echo + echo "Change the name of the file and its title." + echo "Commit the changes to the 'main' branch." + echo + echo "=============================================================" + echo "skip=true" >>"$GITHUB_OUTPUT" + elif [ ! -f draft-todo-yourname-protocol.md -a -f Makefile ]; then + echo "=============================================================" + echo "Skipping setup for an already-configured repository." + echo + echo "Delete .github/workflows/setup.yml to avoid running this action:" + echo + echo " https://github.com/${{github.repository}}/delete/main/.github/workflows/setup.yml" + echo + echo "=============================================================" + echo "skip=true" >>"$GITHUB_OUTPUT" + fi + + - name: "Git Config" + if: ${{ steps.pre.outputs.skip != 'true' }} + run: | + git config user.email "idbot@example.com" + git config user.name "I-D Bot" + + - name: "Update Draft Name" + if: ${{ steps.pre.outputs.skip != 'true' }} + run: | + for i in draft-*; do + if [ "$(head -1 "$i")" = "---" ]; then + sed -i -e '2,/^---/{/^###/,/^###/d + s|^docname: .*|docname: '"${i%.md}-latest"'| + s|^ fullname: Your Name Here| fullname: "'"$(git show -q --format='format:%aN' @)"'"| + s|^ email: your\.email@example\.com| email: "'"$(git show -q --format='format:%aE' @)"'"| + }' "$i" + fi + sed -i -e "s/draft-todo-yourname-protocol-latest/${i%.md}-latest/g" "$i" + git add "$i" + done + if [ -n "$(git status --porcelain draft-*)" ]; then + git commit -m "Update draft labels" draft-* + fi + + - name: "Cleanup" + if: ${{ steps.pre.outputs.skip != 'true' }} + run: | + git rm -rf .github/workflows/setup.yml README.md + git commit -m "Remove setup files" + + - name: "Clone the i-d-template Repo" + if: ${{ steps.pre.outputs.skip != 'true' }} + run: | + git clone --depth=1 https://github.com/martinthomson/i-d-template lib + + - name: "Run i-d-template Setup" + if: ${{ steps.pre.outputs.skip != 'true' }} + uses: martinthomson/i-d-template@v1 + with: + make: setup + + - name: "Update Venue Information" + if: ${{ steps.pre.outputs.skip != 'true' }} + uses: martinthomson/i-d-template@v1 + with: + make: update-venue + + - name: "Update GitHub Pages" + if: ${{ steps.pre.outputs.skip != 'true' }} + uses: martinthomson/i-d-template@v1 + with: + make: gh-pages + + - name: "Push Changes" + if: ${{ steps.pre.outputs.skip != 'true' }} + run: | + git push diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..0f8d6b8 --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,36 @@ +name: "Update Generated Files" +# This rule is not run automatically. +# It can be run manually to update all of the files that are part +# of the template, specifically: +# - README.md +# - CONTRIBUTING.md +# - .note.xml +# - .github/CODEOWNERS +# - Makefile +# +# +# This might be useful if you have: +# - added, removed, or renamed drafts (including after adoption) +# - added, removed, or changed draft editors +# - changed the title of drafts +# +# Note that this removes any customizations you have made to +# the affected files. +on: workflow_dispatch + +jobs: + build: + name: "Update Files" + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v4 + + - name: "Update Generated Files" + uses: martinthomson/i-d-template@v1 + with: + make: update-files + token: ${{ github.token }} + + - name: "Push Update" + run: git push diff --git a/README.md b/README.md new file mode 100644 index 0000000..2583c57 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Internet-Draft Template Repository + +Use this repository as a template if you want to start working on +[IETF](https://www.ietf.org/) documents. [Click here to create a new repository using the +template](https://github.com/martinthomson/internet-draft-template/generate). +Make sure to check "Include all branches", or you will need to enable GitHub Pages manually. + +[Read the +instructions](https://github.com/martinthomson/i-d-template/blob/main/doc/TEMPLATE.md) +for more information. + +Once you have created your own repository, start work by: + +1. Set "Workflow permissions" to "Read and write permissions" + [in the repository settings](../../settings/actions#actions_default_workflow_permissions_write). + +2. Rename the `draft-todo-yourname-protocol.md` file + [here](../../edit/main/draft-todo-yourname-protocol.md). diff --git a/draft-todo-yourname-protocol.md b/draft-todo-yourname-protocol.md new file mode 100644 index 0000000..fa51372 --- /dev/null +++ b/draft-todo-yourname-protocol.md @@ -0,0 +1,89 @@ +--- +### +# Internet-Draft Markdown Template +# +# Rename this file from draft-todo-yourname-protocol.md to get started. +# Draft name format is "draft---.md". +# +# For initial setup, you only need to edit the first block of fields. +# Only "title" needs to be changed; delete "abbrev" if your title is short. +# Any other content can be edited, but be careful not to introduce errors. +# Some fields will be set automatically during setup if they are unchanged. +# +# Don't include "-00" or "-latest" in the filename. +# Labels in the form draft----latest are used by +# the tools to refer to the current version; see "docname" for example. +# +# This template uses kramdown-rfc: https://github.com/cabo/kramdown-rfc +# You can replace the entire file if you prefer a different format. +# Change the file extension to match the format (.xml for XML, etc...) +# +### +title: "TODO - Your title" +abbrev: "TODO - Abbreviation" +category: info + +docname: draft-todo-yourname-protocol-latest +submissiontype: IETF # also: "independent", "editorial", "IAB", or "IRTF" +number: +date: +consensus: true +v: 3 +area: AREA +workgroup: WG Working Group +keyword: + - next generation + - unicorn + - sparkling distributed ledger +venue: + group: WG + type: Working Group + mail: WG@example.com + arch: https://example.com/WG + github: USER/REPO + latest: https://example.com/LATEST + +author: + - + fullname: Your Name Here + organization: Your Organization Here + email: your.email@example.com + +normative: + +informative: + + +--- abstract + +TODO Abstract + + +--- middle + +# Introduction + +TODO Introduction + + +# Conventions and Definitions + +{::boilerplate bcp14-tagged} + + +# Security Considerations + +TODO Security + + +# IANA Considerations + +This document has no IANA actions. + + +--- back + +# Acknowledgments +{:numbered="false"} + +TODO acknowledge.