mirror of
				https://github.com/privacyguides/privacyguides.org.git
				synced 2025-10-31 03:26:35 +00:00 
			
		
		
		
	Transition to mkdocs (#829)
Co-authored-by: Jonah Aragon <jonah@triplebit.net>
This commit is contained in:
		
							
								
								
									
										53
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| name: Build Website | ||||
| on: | ||||
|   pull_request: | ||||
|     branches: | ||||
|       - main | ||||
|  | ||||
| env: | ||||
|   PYTHON_VERSION: 3.x | ||||
|  | ||||
| jobs: | ||||
|   build: | ||||
|     name: Build website | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|  | ||||
|       - name: Checkout repository | ||||
|         uses: actions/checkout@v3 | ||||
|  | ||||
|       - name: Set up Python runtime | ||||
|         uses: actions/setup-python@v3 | ||||
|         with: | ||||
|           python-version: ${{ env.PYTHON_VERSION }} | ||||
|        | ||||
|       - name: Cache files | ||||
|         uses: actions/cache@v2 | ||||
|         with: | ||||
|           key: ${{ github.ref }} | ||||
|           path: .cache | ||||
|  | ||||
|       - name: Install Python dependencies | ||||
|         run: | | ||||
|           pip install 'mkdocs>=1.3.0' | ||||
|  | ||||
|       - name: Install mkdocs-material Insiders build | ||||
|         if: github.event.repository.fork == false | ||||
|         env: | ||||
|           GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||||
|         run: | | ||||
|           git clone --depth 1 https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git | ||||
|           pip install -e mkdocs-material-insiders | ||||
|  | ||||
|       - name: Build website | ||||
|         run: | | ||||
|           mkdocs build --config-file mkdocs.production.yml | ||||
|           mv .well-known site/ | ||||
|           tar cvf site.tar site | ||||
|           mkdocs --version | ||||
|  | ||||
|       - name: Package website | ||||
|         uses: actions/upload-artifact@v2 | ||||
|         with: | ||||
|           name: generated-site | ||||
|           path: site.tar | ||||
							
								
								
									
										73
									
								
								.github/workflows/deploy.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								.github/workflows/deploy.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,73 @@ | ||||
| name: Deploy Website | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|  | ||||
| env: | ||||
|   PYTHON_VERSION: 3.x | ||||
|  | ||||
| jobs: | ||||
|   build: | ||||
|     name: Build website | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|  | ||||
|       - name: Checkout repository | ||||
|         uses: actions/checkout@v3 | ||||
|  | ||||
|       - name: Set up Python runtime | ||||
|         uses: actions/setup-python@v3 | ||||
|         with: | ||||
|           python-version: ${{ env.PYTHON_VERSION }} | ||||
|        | ||||
|       - name: Cache files | ||||
|         uses: actions/cache@v2 | ||||
|         with: | ||||
|           key: ${{ github.ref }} | ||||
|           path: .cache | ||||
|  | ||||
|       - name: Install Python dependencies | ||||
|         run: | | ||||
|           pip install 'mkdocs>=1.3.0' | ||||
|  | ||||
|       - name: Install mkdocs-material Insiders build | ||||
|         if: github.event.repository.fork == false | ||||
|         env: | ||||
|           GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||||
|         run: | | ||||
|           git clone --depth 1 https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git | ||||
|           pip install -e mkdocs-material-insiders | ||||
|  | ||||
|       - name: Build website | ||||
|         run: | | ||||
|           mkdocs build --config-file mkdocs.production.yml | ||||
|           mv .well-known site/ | ||||
|           tar cvf site.tar site | ||||
|           mkdocs --version | ||||
|  | ||||
|       - name: Package website | ||||
|         uses: actions/upload-artifact@v2 | ||||
|         with: | ||||
|           name: generated-site | ||||
|           path: site.tar | ||||
|  | ||||
|   deploy: | ||||
|     name: Rsync Deploy | ||||
|     runs-on: ubuntu-latest | ||||
|     environment: production | ||||
|     needs: build | ||||
|  | ||||
|     steps: | ||||
|       - name: Download generated Jekyll site | ||||
|         uses: actions/download-artifact@v2 | ||||
|         with: | ||||
|           name: generated-site | ||||
|       - run: tar xvf site.tar | ||||
|       - name: Copy built site to production | ||||
|         run: | | ||||
|           mkdir -p ~/.ssh | ||||
|           echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa | ||||
|           chmod 700 ~/.ssh/id_rsa | ||||
|           ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | ||||
|           rsync -azP --delete site/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_PATH }} | ||||
							
								
								
									
										62
									
								
								.github/workflows/production.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										62
									
								
								.github/workflows/production.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,62 +0,0 @@ | ||||
| name: Production Deploy | ||||
| concurrency: | ||||
|   group: Production | ||||
|   cancel-in-progress: true | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     branches: [ main ] | ||||
|  | ||||
| env: | ||||
|   FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | ||||
|  | ||||
| jobs: | ||||
|   build: | ||||
|     name: Jekyll Build | ||||
|     runs-on: ubuntu-latest | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|     - uses: ruby/setup-ruby@v1 | ||||
|       with: | ||||
|         bundler-cache: true | ||||
|     - uses: actions/setup-node@v3 | ||||
|       with: | ||||
|         node-version: '14' | ||||
|     - name: Cache Jekyll build | ||||
|       uses: actions/cache@v3 | ||||
|       with: | ||||
|         path: | | ||||
|           .jekyll-cache | ||||
|           .sass-cache | ||||
|         key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} | ||||
|     - name: Install dependencies | ||||
|       run: npm install | ||||
|     - name: Build website | ||||
|       uses: ./.github/actions/build | ||||
|     - run: tar cvf site.tar _site | ||||
|     - name: Upload generated Jekyll site | ||||
|       uses: actions/upload-artifact@v2 | ||||
|       with: | ||||
|         name: generated-site | ||||
|         path: site.tar | ||||
|  | ||||
|   deploy: | ||||
|     name: Rsync Deploy | ||||
|     runs-on: ubuntu-latest | ||||
|     environment: production | ||||
|     needs: build | ||||
|  | ||||
|     steps: | ||||
|     - name: Download generated Jekyll site | ||||
|       uses: actions/download-artifact@v2 | ||||
|       with: | ||||
|         name: generated-site | ||||
|     - run: tar xvf site.tar | ||||
|     - name: Copy built site to production | ||||
|       run: | | ||||
|         mkdir -p ~/.ssh | ||||
|         echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa | ||||
|         chmod 700 ~/.ssh/id_rsa | ||||
|         ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | ||||
|         rsync -azP --delete _site/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_PATH }} | ||||
							
								
								
									
										238
									
								
								.github/workflows/tests.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										238
									
								
								.github/workflows/tests.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,238 +0,0 @@ | ||||
| name: Code tests | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|   pull_request: | ||||
|     branches: | ||||
|       - main | ||||
|  | ||||
| env: | ||||
|   FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | ||||
|  | ||||
| jobs: | ||||
|   deps: | ||||
|     name: "Dependency Install" | ||||
|     runs-on: ubuntu-latest | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|     - name: Cache node modules | ||||
|       uses: actions/cache@v3 | ||||
|       with: | ||||
|         path: ~/.npm | ||||
|         key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | ||||
|         restore-keys: | | ||||
|           ${{ runner.os }}-npm- | ||||
|     - uses: actions/setup-node@v3 | ||||
|       with: | ||||
|         node-version: '14' | ||||
|     - run: npm install | ||||
|     - run: tar cvf node_modules.tar node_modules | ||||
|     - name: Upload node_modules for Jekyll build | ||||
|       uses: actions/upload-artifact@v2 | ||||
|       with: | ||||
|         name: node_modules | ||||
|         path: node_modules.tar | ||||
|  | ||||
|   build: | ||||
|     name: "Jekyll Build" | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: deps | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|     - uses: ruby/setup-ruby@v1 | ||||
|       with: | ||||
|         bundler-cache: true | ||||
|     - uses: actions/setup-node@v3 | ||||
|       with: | ||||
|         node-version: '14' | ||||
|     - name: Cache Jekyll build | ||||
|       uses: actions/cache@v3 | ||||
|       with: | ||||
|         path: | | ||||
|           .jekyll-cache | ||||
|           .sass-cache | ||||
|         key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} | ||||
|         restore-keys: | | ||||
|           ${{ runner.os }}-jekyll- | ||||
|     - name: Set Date and Time | ||||
|       run: | | ||||
|         sed -i "s/^     date:.*$/     date: $(TZ=UTC date "+%Y-%m-%d")/" _config.yml | ||||
|         sed -i "s/^     time:.*$/     time: $(TZ=UTC date "+%H:%M:%S %Z")/" _config.yml | ||||
|     - name: Download node_modules | ||||
|       uses: actions/download-artifact@v2 | ||||
|       with: | ||||
|         name: node_modules | ||||
|     - run: tar xvf node_modules.tar | ||||
|     - name: Generate Website | ||||
|       run: npm run build | ||||
|     - run: tar cvf site.tar _site | ||||
|     - name: Upload generated Jekyll site | ||||
|       uses: actions/upload-artifact@v2 | ||||
|       with: | ||||
|         name: generated-site | ||||
|         path: site.tar | ||||
|  | ||||
|   link: | ||||
|     name: "Broken Hyperlinks (Internal)" | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: build | ||||
|  | ||||
|     steps: | ||||
|     - uses: actions/checkout@v3 | ||||
|     - name: Download generated Jekyll site | ||||
|       uses: actions/download-artifact@v2 | ||||
|       with: | ||||
|         name: generated-site | ||||
|     - run: tar xvf site.tar | ||||
|     - name: Copy built site to production | ||||
|       run: | | ||||
|         mv ${{ github.workspace }}/_site /tmp/ | ||||
|         mkdir -p /tmp/src | ||||
|         mv ${{ github.workspace }}/* /tmp/src/ | ||||
|         mkdir -p ${{ github.workspace }}/src | ||||
|         mv /tmp/src/* ${{ github.workspace }}/src/ | ||||
|         mv /tmp/_site ${{ github.workspace }}/ | ||||
|     - name: Internal link checker | ||||
|       uses: untitaker/hyperlink@0.1.21 | ||||
|       with: | ||||
|         args: _site/ --sources src/ | ||||
|  | ||||
|   extlink: | ||||
|     name: "Broken Hyperlinks (External)" | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: [build, link] | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
|       - name: Download generated Jekyll site | ||||
|         uses: actions/download-artifact@v2 | ||||
|         with: | ||||
|           name: generated-site | ||||
|       - run: tar xvf site.tar | ||||
|       - name: Cache HTMLProofer | ||||
|         id: cache-htmlproofer | ||||
|         uses: actions/cache@v3 | ||||
|         with: | ||||
|           path: tmp/.htmlproofer | ||||
|           key: ${{ runner.os }}-htmlproofer-${{ hashFiles('_site/**.html') }} | ||||
|           restore-keys: | | ||||
|             ${{ runner.os }}-htmlproofer- | ||||
|             ${{ runner.os }}-htmlproofer | ||||
|       - name: Check External Links (Informational, Soft-Fail) | ||||
|         uses: chabad360/htmlproofer@v1.1 | ||||
|         with: | ||||
|           directory: ${{ github.workspace }}/_site | ||||
|           arguments: --assume-extension --external_only --internal-domains privacyguides.org,www.privacyguides.org --timeframe 30d --url-ignore '/https:\/\/developers\.cloudflare\.com\//,/https:\/\/github\.com\/privacyguides\/privacyguides\.org\/(edit|tree|blob)\/main/,/https:\/\/support\.(startmail|yubico)\.com\//' | ||||
|         continue-on-error: true | ||||
|  | ||||
|   https: | ||||
|     name: "Require HTTPS Internal Images" | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: build | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
|       - name: Download generated Jekyll site | ||||
|         uses: actions/download-artifact@v2 | ||||
|         with: | ||||
|           name: generated-site | ||||
|       - run: tar xvf site.tar | ||||
|       - name: Check Images | ||||
|         uses: chabad360/htmlproofer@v1.1 | ||||
|         with: | ||||
|           directory: ${{ github.workspace }}/_site | ||||
|           arguments: --assume-extension --check-img-http --internal-domains privacyguides.org,www.privacyguides.org --disable-external --checks-to-ignore LinkCheck,ScriptCheck | ||||
|  | ||||
|   scripts: | ||||
|     name: "Script Reference Checks" | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: [build, link] | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
|       - name: Download generated Jekyll site | ||||
|         uses: actions/download-artifact@v2 | ||||
|         with: | ||||
|           name: generated-site | ||||
|       - run: tar xvf site.tar | ||||
|       - name: Check HTML | ||||
|         uses: chabad360/htmlproofer@v1.1 | ||||
|         with: | ||||
|           directory: ${{ github.workspace }}/_site | ||||
|           arguments: --assume-extension --check-html --disable-external --check-sri --report-script-embeds --internal-domains privacyguides.org,www.privacyguides.org --checks-to-ignore LinkCheck,ImageCheck,HtmlCheck | ||||
|  | ||||
|   tags: | ||||
|     name: "HTML Tag Test" | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: build | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
|       - name: Download generated Jekyll site | ||||
|         uses: actions/download-artifact@v2 | ||||
|         with: | ||||
|           name: generated-site | ||||
|       - run: tar xvf site.tar | ||||
|       - name: Validate HTML | ||||
|         uses: chabad360/htmlproofer@v1.1 | ||||
|         with: | ||||
|           directory: ${{ github.workspace }}/_site | ||||
|           arguments: --assume-extension --check-html --disable-external --allow-hash-href --internal-domains privacyguides.org,www.privacyguides.org --report-invalid-tags --report-eof-tags --report-mismatched-tags --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck | ||||
|  | ||||
|   entity: | ||||
|     name: "HTML Entity Names Test" | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: build | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
|       - name: Download generated Jekyll site | ||||
|         uses: actions/download-artifact@v2 | ||||
|         with: | ||||
|           name: generated-site | ||||
|       - run: tar xvf site.tar | ||||
|       - name: Validate HTML | ||||
|         uses: chabad360/htmlproofer@v1.1 | ||||
|         with: | ||||
|           directory: ${{ github.workspace }}/_site | ||||
|           arguments: --assume-extension --check-html --disable-external --allow-hash-href --internal-domains privacyguides.org,www.privacyguides.org --report-missing-names --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck | ||||
|  | ||||
|   misc: | ||||
|     name: "Misc HTML Test" | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: build | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
|       - name: Download generated Jekyll site | ||||
|         uses: actions/download-artifact@v2 | ||||
|         with: | ||||
|           name: generated-site | ||||
|       - run: tar xvf site.tar | ||||
|       - name: Validate HTML | ||||
|         uses: chabad360/htmlproofer@v1.1 | ||||
|         with: | ||||
|           directory: ${{ github.workspace }}/_site | ||||
|           arguments: --assume-extension --check-html --disable-external --internal-domains privacyguides.org,www.privacyguides.org --report-missing-doctype --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck | ||||
|  | ||||
|   opengraph: | ||||
|     name: "OpenGraph Test" | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: build | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v3 | ||||
|       - name: Download generated Jekyll site | ||||
|         uses: actions/download-artifact@v2 | ||||
|         with: | ||||
|           name: generated-site | ||||
|       - run: tar xvf site.tar | ||||
|       - name: Check OpenGraph | ||||
|         uses: chabad360/htmlproofer@v1.1 | ||||
|         with: | ||||
|           directory: ${{ github.workspace }}/_site | ||||
|           arguments: --assume-extension --disable-external --check-opengraph --checks-to-ignore LinkCheck,ImageCheck,ScriptCheck | ||||
		Reference in New Issue
	
	Block a user
	 Daniel Gray
					Daniel Gray