diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index c5d0dd6a..1d59b8f8 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -3,8 +3,6 @@ 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 diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 7bd0adec..cc963f1c 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -11,10 +11,9 @@ env: FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} jobs: - deploy: - name: Rsync Deploy + build: + name: Jekyll Build runs-on: ubuntu-latest - environment: production steps: - uses: actions/checkout@v2 @@ -31,12 +30,33 @@ jobs: .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 ${{ github.workspace }}/_site/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:privacyguides.org-deploy + rsync -azP --delete _site/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:privacyguides.org-deploy diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3c442bd1..70b17fb8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,9 +18,6 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - name: Cache node modules uses: actions/cache@v2 with: @@ -32,24 +29,23 @@ jobs: with: node-version: '14' - run: npm install - - run: npm run assets: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@v2 - uses: ruby/setup-ruby@v1 with: bundler-cache: true - - name: Cache node modules - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - uses: actions/setup-node@v2 with: node-version: '14' @@ -62,40 +58,36 @@ jobs: key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} restore-keys: | ${{ runner.os }}-jekyll- - - name: Build website - uses: ./.github/actions/build + - 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: [deps, build] + needs: build steps: - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 + - name: Download generated Jekyll site + uses: actions/download-artifact@v2 with: - bundler-cache: true - - name: Cache node modules - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Cache Jekyll build - uses: actions/cache@v2 - with: - path: | - .jekyll-cache - .sass-cache - key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} - restore-keys: | - ${{ runner.os }}-jekyll- - - name: Build website - uses: ./.github/actions/build + name: generated-site + - run: tar xvf site.tar - name: Copy built site to production run: | mv ${{ github.workspace }}/_site /tmp/ @@ -116,30 +108,11 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 + - name: Download generated Jekyll site + uses: actions/download-artifact@v2 with: - bundler-cache: true - - name: Cache node modules - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Cache Jekyll build - uses: actions/cache@v2 - with: - path: | - .jekyll-cache - .sass-cache - key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} - restore-keys: | - ${{ runner.os }}-jekyll- - - name: Build website - uses: ./.github/actions/build + name: generated-site + - run: tar xvf site.tar - name: Cache HTMLProofer id: cache-htmlproofer uses: actions/cache@v2 @@ -149,7 +122,7 @@ jobs: restore-keys: | ${{ runner.os }}-htmlproofer- ${{ runner.os }}-htmlproofer - - name: Check All External Links (Informational) + - name: Check All External Links (Informational, Soft-Fail) uses: chabad360/htmlproofer@v1.1 with: directory: ${{ github.workspace }}/_site @@ -168,30 +141,11 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 + - name: Download generated Jekyll site + uses: actions/download-artifact@v2 with: - bundler-cache: true - - name: Cache node modules - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Cache Jekyll build - uses: actions/cache@v2 - with: - path: | - .jekyll-cache - .sass-cache - key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} - restore-keys: | - ${{ runner.os }}-jekyll- - - name: Build website - uses: ./.github/actions/build + name: generated-site + - run: tar xvf site.tar - name: Check Images uses: chabad360/htmlproofer@v1.1 with: @@ -205,23 +159,11 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 + - name: Download generated Jekyll site + uses: actions/download-artifact@v2 with: - bundler-cache: true - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Cache Jekyll build - uses: actions/cache@v2 - with: - path: | - .jekyll-cache - .sass-cache - key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} - restore-keys: | - ${{ runner.os }}-jekyll- - - name: Build website - uses: ./.github/actions/build + name: generated-site + - run: tar xvf site.tar - name: Check HTML uses: chabad360/htmlproofer@v1.1 with: @@ -235,31 +177,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 + - name: Download generated Jekyll site + uses: actions/download-artifact@v2 with: - bundler-cache: true - - name: Cache node modules - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Cache Jekyll build - uses: actions/cache@v2 - with: - path: | - .jekyll-cache - .sass-cache - key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} - restore-keys: | - ${{ runner.os }}-jekyll- - - name: Build website - uses: ./.github/actions/build - - name: Check HTML + name: generated-site + - run: tar xvf site.tar + - name: Validate HTML uses: chabad360/htmlproofer@v1.1 with: directory: ${{ github.workspace }}/_site @@ -272,31 +195,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 + - name: Download generated Jekyll site + uses: actions/download-artifact@v2 with: - bundler-cache: true - - name: Cache node modules - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Cache Jekyll build - uses: actions/cache@v2 - with: - path: | - .jekyll-cache - .sass-cache - key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} - restore-keys: | - ${{ runner.os }}-jekyll- - - name: Build website - uses: ./.github/actions/build - - name: Check HTML + name: generated-site + - run: tar xvf site.tar + - name: Validate HTML uses: chabad360/htmlproofer@v1.1 with: directory: ${{ github.workspace }}/_site @@ -309,31 +213,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 + - name: Download generated Jekyll site + uses: actions/download-artifact@v2 with: - bundler-cache: true - - name: Cache node modules - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Cache Jekyll build - uses: actions/cache@v2 - with: - path: | - .jekyll-cache - .sass-cache - key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} - restore-keys: | - ${{ runner.os }}-jekyll- - - name: Build website - uses: ./.github/actions/build - - name: Check HTML + name: generated-site + - run: tar xvf site.tar + - name: Validate HTML uses: chabad360/htmlproofer@v1.1 with: directory: ${{ github.workspace }}/_site @@ -346,31 +231,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 + - name: Download generated Jekyll site + uses: actions/download-artifact@v2 with: - bundler-cache: true - - name: Cache node modules - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Cache Jekyll build - uses: actions/cache@v2 - with: - path: | - .jekyll-cache - .sass-cache - key: ${{ runner.os }}-jekyll-${{ hashFiles('**/*.??m[ld]') }} - restore-keys: | - ${{ runner.os }}-jekyll- - - name: Build website - uses: ./.github/actions/build - - name: Check HTML + name: generated-site + - run: tar xvf site.tar + - name: Check OpenGraph uses: chabad360/htmlproofer@v1.1 with: directory: ${{ github.workspace }}/_site