diff --git a/.github/cf-automation.yml b/.github/cf-automation.yml index 4732572..fc5d800 100644 --- a/.github/cf-automation.yml +++ b/.github/cf-automation.yml @@ -59,6 +59,7 @@ notice: - edited - closed paths: + - agreements/project-contribution/* - bylaws/* - policies/* label: ["!notice"] @@ -95,11 +96,11 @@ voting: - source: CONTACTS.yaml repo: commonhaus/foundation mapping: - - field: project - primary: + - field: project + primary: data: egc team: commonhaus/cf-egc - secondary: + secondary: data: egc-second team: commonhaus/cf-egc-second exclude_login: diff --git a/.github/docker-build-pdf.sh b/.github/docker-build-pdf.sh index d6e89e4..8a7d545 100755 --- a/.github/docker-build-pdf.sh +++ b/.github/docker-build-pdf.sh @@ -82,55 +82,29 @@ if [[ "${TO_CMD}" != "noargs" ]]; then fi # Convert markdown to PDF with an appended changelog -function to_pdf_pattern() { - local tmpout=output/tmp/${1} - shift - local pdfout=output/public/${1} - shift - local relative_path=${1} - shift - - mkdir -p "${tmpout}" - rm -f "${tmpout}"/* - rm -f "${pdfout}" - - # Use mounted volume paths - run_pdf --pdf-engine-opt=-output-dir="./${tmpout}" \ - --pdf-engine-opt=-outdir="./${tmpout}" \ - -o "./${pdfout}" \ - -V dirname:"${relative_path}" \ - "$@" -} - -# Convert markdown to PDF with an appended changelog -# to_pdf ./TRADEMARKS.md trademark-list ./ "Commonhaus Foundation Trademark List" +# working-dir is used to resolve resources in the file +# to_pdf pdf-basename cwd sources+args +# to_pdf trademark-list ./ sources+args +# to_pdf x ./policies sources+args +# to_pdf cf-bylaws ./bylaws sources+args function to_pdf() { - if [[ ! -f "${1}" ]]; then - echo "No source file found at ${1}" - exit 1 - fi - local source=${1} - shift local basename=${1} shift local relative_path=${1} shift - local title=${1} - shift - local tmpout=output/tmp/${basename} + local tmpout=./output/tmp/${basename} mkdir -p "${tmpout}" rm -f "${tmpout}"/* - local pdfout=output/public/${basename}.pdf + local pdfout=./output/public/${basename}.pdf rm -f "${pdfout}" # Use mounted volume paths - run_pdf --pdf-engine-opt=-output-dir="./${tmpout}" \ - --pdf-engine-opt=-outdir="./${tmpout}" \ - -o "./${pdfout}" \ - -M title:"${title}" \ + run_pdf --pdf-engine-opt=-output-dir="${tmpout}" \ + --pdf-engine-opt=-outdir="${tmpout}" \ -V dirname:"${relative_path}" \ - "${source}" + -o "${pdfout}" \ + "$@" } # Convert markdown to PDF @@ -150,11 +124,9 @@ function run_pdf() { function run_docx() { ${DOCKER} run ${ARGS} \ "${PANDOCK}" \ - -d ./.pandoc/agreements.yaml \ -M date-meta:"$(date +%B\ %d,\ %Y)" \ -V github:"${URL}" \ - -o "$1" \ - "$2" + "$@" echo "$?" } @@ -164,35 +136,21 @@ mkdir -p output/public ## BYLAWS -# Sorted order of files for Bylaws -BYLAWS=( - ./bylaws/1-preface.md - ./bylaws/2-purpose.md - ./bylaws/3-cf-membership.md - ./bylaws/4-cf-council.md - ./bylaws/5-cf-advisory-board.md - ./bylaws/6-decision-making.md - ./bylaws/7-notice-records.md - ./bylaws/8-indemnification-dissolution.md - ./bylaws/9-amendments.md -) - if [[ -z "${SKIP_BYLAWS}" ]]; then - # Verify that bylaws files exist - for x in "${BYLAWS[@]}"; do - if [[ ! -f ${x} ]]; then - echo "No file found at ${x}" - exit 1 - fi - done - - # # Convert bylaws to PDF - to_pdf_pattern \ - bylaws \ - "cf-bylaws.pdf" \ + # Convert bylaws to PDF + to_pdf \ + "cf-bylaws" \ "./bylaws/" \ - -M title:"Bylaws" \ - "${BYLAWS[@]}" + -M "title:Bylaws" \ + ./bylaws/1-preface.md \ + ./bylaws/2-purpose.md \ + ./bylaws/3-cf-membership.md \ + ./bylaws/4-cf-council.md \ + ./bylaws/5-cf-advisory-board.md \ + ./bylaws/6-decision-making.md \ + ./bylaws/7-notice-records.md \ + ./bylaws/8-indemnification-dissolution.md \ + ./bylaws/9-amendments.md fi ## POLICIES @@ -203,27 +161,34 @@ function to_policy_pdf() { echo "No policy found at ./policies/${1}.md" exit 1 fi - to_pdf_pattern \ + # to_pdf pdf-basename working-dir title ... whatever else + to_pdf \ "${1}" \ - "${1}.pdf" \ "./policies/" \ - -M title:"${2} Policy" \ + -M "title:${2} Policy" \ "./policies/${1}.md" } if [[ -z "${SKIP_POLICIES}" ]]; then - # Convert all policies to PDF - to_policy_pdf code-of-conduct "Code of Conduct" - to_policy_pdf conflict-of-interest "Conflict of Interest" - to_policy_pdf ip-policy "Intellectual Property" - to_policy_pdf trademark-policy "Trademark" - - to_pdf ./TRADEMARKS.md trademark-list ./ "Trademark List" + # Convert policies to PDF + # function source file (no extension) Policy + to_policy_pdf code-of-conduct "Code of Conduct" + to_policy_pdf conflict-of-interest "Conflict of Interest" + to_policy_pdf ip-policy "Intellectual Property" + to_policy_pdf trademark-policy "Trademark" + + # to_pdf pdf-file-name cwd the rest... + to_pdf trademark-list ./ -M "title:Trademark List" ./TRADEMARKS.md fi ## AGREEMENTS function to_agreement_doc() { + local config="./.pandoc/agreements.yaml" + if [[ "${1}" == "true" ]]; then + config="./.pandoc/draft-agreements.yaml" + fi + shift local input=${1} if [[ ! -f "./agreements/${input}.md" ]]; then echo "No agreement found at ./agreements/${input}.md" @@ -234,15 +199,17 @@ function to_agreement_doc() { output=$(basename ${input}) fi run_docx \ - "./output/public/${output}.docx" \ + -o "./output/public/${output}.docx" \ + -d "./.pandoc/agreements.yaml" \ "./agreements/${input}.md" } if [[ -z "${SKIP_AGREEMENTS}" ]]; then - to_agreement_doc bootstrapping/bootstrapping bootstrapping-agreement - # to_agreement_doc project-contribution/asset-transfer-agreement - # to_agreement_doc project-contribution/fiscal-sponsorship-agreement - # to_agreement_doc project-contribution/fiscal-sponsorship-terms-and-conditions + # function is_draft markdown source (no extension) + to_agreement_doc false bootstrapping/bootstrapping bootstrapping-agreement +# to_agreement_doc true project-contribution/asset-transfer-agreement +# to_agreement_doc true project-contribution/fiscal-sponsorship-agreement +# to_agreement_doc true project-contribution/fiscal-sponsorship-terms-and-conditions fi ls -al output/public \ No newline at end of file diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 56ae8d8..dbdaf91 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -2,9 +2,17 @@ name: Validate markdown and YAML on: pull_request: + paths: + - '*.md' + - '*.yml' + - '*.yaml' push: branches: - main + paths: + - '*.md' + - '*.yml' + - '*.yaml' workflow_dispatch: env: diff --git a/.github/workflows/notice.yaml b/.github/workflows/notice.yaml index 81c2682..95b0eef 100644 --- a/.github/workflows/notice.yaml +++ b/.github/workflows/notice.yaml @@ -1,22 +1,20 @@ -name: Push discussions and PR activity to commonhaus.github.io +name: Push activity to commonhaus.github.io on: discussion: pull_request_target: types: [opened, edited, reopened, closed] - paths: - - '*.md' - - '*.yaml' - - 'bylaws/**' - - 'policies/**' + paths-ignore: + - '.*' + - 'elections' + - 'templates' push: branches: - main - paths: - - '*.md' - - '*.yaml' - - 'bylaws/**' - - 'policies/**' + paths-ignore: + - '.*' + - 'elections' + - 'templates' workflow_dispatch: permissions: {} @@ -33,3 +31,4 @@ jobs: GH_TOKEN: ${{ secrets.ACTIONS_PUBLISH_PAT }} run: | gh workflow run -R commonhaus/commonhaus.github.io push-content.yml + diff --git a/.github/workflows/build.yaml b/.github/workflows/pdf-build.yaml similarity index 81% rename from .github/workflows/build.yaml rename to .github/workflows/pdf-build.yaml index d57e51d..4dae48f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/pdf-build.yaml @@ -1,4 +1,4 @@ -name: Build PDF and publish to commonhaus.github.io +name: Build PDF / Docx on: pull_request: @@ -31,20 +31,7 @@ jobs: steps: - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'commonhaus/foundation' id: is-main-root - run: echo "test=true" >> "$GITHUB_OUTPUT" - - update-website: - needs: main-root - runs-on: ubuntu-latest - if: ${{ needs.main-root.outputs.is-main }} - permissions: - actions: read - steps: - - name: Bump website - env: - GH_TOKEN: ${{ secrets.ACTIONS_PUBLISH_PAT }} - run: | - gh workflow run -R commonhaus/commonhaus.github.io push-content.yml + run: echo "test=true" >> "$GITHUB_OUTPUT package: name: Package PDFs @@ -98,4 +85,4 @@ jobs: # These must be done separately to correctly toggle draft flag gh release edit SNAPSHOT -t "PDF snapshot" --prerelease gh release view SNAPSHOT - gh release edit SNAPSHOT --draft=false + gh release edit SNAPSHOT --draft=false \ No newline at end of file