Create GitHub Action

This commit is contained in:
Jonah Aragon 2021-05-01 16:24:18 -05:00
parent 61a8abbd15
commit 01995be1f4
No known key found for this signature in database
GPG Key ID: 6A957C9A9A9429F7
7 changed files with 117 additions and 15 deletions

View File

@ -1,11 +0,0 @@
export BUILD_DATE=$(TZ=UTC date "+%Y-%m-%d")
export BUILD_TIME=$(TZ=UTC date "+%H:%M:%S %Z")
npm install
gem install bundler:2.2.5
bundle install
sed -i "s/^ date:.*$/ date: $BUILD_DATE/" _config.yml
sed -i "s/^ time:.*$/ time: $BUILD_TIME/" _config.yml
JEKYLL_ENV=production bundle exec jekyll build

13
.github/actions/build/action.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: 'Build'
description: 'Builds Jekyll Site'
runs:
using: "composite"
steps:
- shell: bash
run: npm install
- shell: bash
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
- shell: bash
run: npm run build

35
.github/workflows/production.yml vendored Normal file
View File

@ -0,0 +1,35 @@
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:
deploy:
name: Rsync Deploy
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Build website
uses: ./.github/actions/build
- 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 ${{ github.workspace }}/_site/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:privacyguides.org-deploy

65
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,65 @@
name: Code tests
on: [push, pull_request]
env:
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
jobs:
deps:
name: "Dependency Install"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- run: npm run assets:install
build:
name: "Jekyll Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Build website
uses: ./.github/actions/build
link:
name: "Broken Hyperlink Check"
runs-on: ubuntu-latest
needs: [deps, build]
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Build website
uses: ./.github/actions/build
- 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: Hyperlink link checker
uses: untitaker/hyperlink@0.1.15
with:
args: _site/ --sources src/

View File

@ -1,7 +1,7 @@
<h1 id="addons" class="anchor"><a href="#addons"><i class="fas fa-link anchor-icon"></i></a> Recommended Browser Add-ons</h1> <h1 id="addons" class="anchor"><a href="#addons"><i class="fas fa-link anchor-icon"></i></a> Recommended Browser Add-ons</h1>
<div class="alert alert-secondary" role="alert"> <div class="alert alert-secondary" role="alert">
Not all of these add-ons are necessary, and many provide redundant functionality. Choose the ones you need, and <a class="alert-link" href="https://privacyguides.org/blog/2019/11/09/firefox-privacy/">learn more with our guide to Firefox Privacy</a>. Not all of these add-ons are necessary, and many provide redundant functionality. Choose the ones you need, and <a class="alert-link" href="/blog/2019/11/09/firefox-privacy/">learn more with our guide to Firefox Privacy</a>.
</div> </div>
{% include legacy/cardv2.html {% include legacy/cardv2.html

View File

@ -127,7 +127,7 @@
<h3>Related Information</h3> <h3>Related Information</h3>
<ul> <ul>
<li><a href="https://privacyguides.org/blog/2019/11/09/firefox-privacy/">Firefox Privacy: Tips and Tricks for Better Browsing</a> - A good starting guide for users looking to keep their data private and secure.</li> <li><a href="/blog/2019/11/09/firefox-privacy/">Firefox Privacy: Tips and Tricks for Better Browsing</a> - A good starting guide for users looking to keep their data private and secure.</li>
<li><a href="https://ffprofile.com/">ffprofile.com</a> - Helps you to create a Firefox profile with the defaults you like.</li> <li><a href="https://ffprofile.com/">ffprofile.com</a> - Helps you to create a Firefox profile with the defaults you like.</li>
<li><a href="https://addons.mozilla.org/firefox/addon/privacy-settings/">Privacy Settings</a> - A Firefox add-on to alter built-in privacy settings easily with a toolbar panel.</li> <li><a href="https://addons.mozilla.org/firefox/addon/privacy-settings/">Privacy Settings</a> - A Firefox add-on to alter built-in privacy settings easily with a toolbar panel.</li>
<li><a href="https://12bytes.org/articles/tech/firefox/the-firefox-privacy-guide-for-dummies/">Firefox Privacy Guide For Dummies</a> - Guide on ways (already discussed and others) to improve your privacy and safety on Firefox.</li> <li><a href="https://12bytes.org/articles/tech/firefox/the-firefox-privacy-guide-for-dummies/">Firefox Privacy Guide For Dummies</a> - Guide on ways (already discussed and others) to improve your privacy and safety on Firefox.</li>

View File

@ -4,8 +4,8 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"assets:copy:js": "cp node_modules/bootstrap/dist/js/bootstrap.bundle.min.js assets/js/vendor/ && cp node_modules/jquery/dist/jquery.min.js assets/js/vendor/", "assets:copy:js": "mkdir -p assets/js/vendor && cp node_modules/bootstrap/dist/js/bootstrap.bundle.min.js assets/js/vendor/ && cp node_modules/jquery/dist/jquery.min.js assets/js/vendor/",
"assets:copy:icons": "mkdir -p assets/fonts/vendor/fontawesome && cp -R \"node_modules/@fortawesome/fontawesome-pro/\" assets/fonts/vendor/fontawesome", "assets:copy:icons": "mkdir -p assets/fonts/vendor/fontawesome && cp -a \"node_modules/@fortawesome/fontawesome-pro/.\" assets/fonts/vendor/fontawesome/",
"assets:install": "npm run assets:copy:js && npm run assets:copy:icons", "assets:install": "npm run assets:copy:js && npm run assets:copy:icons",
"build": "npm run assets:install && bundle exec jekyll build", "build": "npm run assets:install && bundle exec jekyll build",
"serve": "npm run assets:install && bundle exec jekyll serve --incremental --livereload" "serve": "npm run assets:install && bundle exec jekyll serve --incremental --livereload"