From 63da61fadac8855c7ed0c6d1142b0dd407666aa2 Mon Sep 17 00:00:00 2001 From: MDLeom <2809763-curben@users.noreply.gitlab.com> Date: Sun, 9 Jan 2022 07:16:27 +0000 Subject: [PATCH] refactor(actions): replicate gitlab ci - move compression to ci, so brotli package is optional when running locally --- .github/workflows/pages.yml | 28 +++++++++++++++------------- .gitlab-ci.yml | 3 ++- src/script.sh | 5 ++--- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index a9a80c8..fe69a52 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,26 +11,28 @@ on: jobs: pages: runs-on: ubuntu-latest + container: alpine:latest steps: - uses: actions/checkout@v2 - - name: Use latest Node.js LTS - uses: actions/setup-node@v2 - with: - node-version: 'lts/*' - - name: Cache NPM dependencies - uses: actions/cache@v2 - with: - path: node_modules - key: ${{ runner.OS }}-npm-cache - restore-keys: | - ${{ runner.OS }}-npm-cache - name: Install Dependencies - run: npm install + run: | + apk update + apk add brotli curl git grep - name: Build - run: npm run build + run: sh src/script.sh + - name: Compress + run: | + find . -name "oisd*.txt" -type f -print0 | xargs -0 gzip -f -k -9 + find . -name "oisd*.txt" -type f -print0 | xargs -0 brotli -f -k -9 - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public force_orphan: true + - name: 'Upload Artifact' + uses: actions/upload-artifact@v2 + with: + name: artifacts + path: ./tmp/ + retention-days: 30 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 881b3b6..4158a56 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,8 @@ pages: stage: deploy script: - - echo + - find . -name "oisd*.txt" -type f -print0 | xargs -0 gzip -f -k -9 + - find . -name "oisd*.txt" -type f -print0 | xargs -0 brotli -f -k -9 artifacts: paths: diff --git a/src/script.sh b/src/script.sh index 665240d..ac92eec 100644 --- a/src/script.sh +++ b/src/script.sh @@ -1,5 +1,7 @@ #!/bin/sh +# works best on busybox sh + set -efux -o pipefail alias cp="cp -f" @@ -33,8 +35,5 @@ curl "https://dnsmasq.oisd.nl/" -o "oisd_dnsmasq.txt" curl "https://rpz.oisd.nl/basic/" -o "oisd_rpz_light.txt" curl "https://rpz.oisd.nl/" -o "oisd_rpz.txt" -find . -name "oisd*.txt" -type f -print0 | xargs -0 gzip -f -k -9 -find . -name "oisd*.txt" -type f -print0 | xargs -0 brotli -f -k -9 - mkdir "../public/" find . ! -name "*.zip" -type f | xargs cp -t "../public/"