mirror of
https://github.com/BBaoVanC/bbaovanc.com.git
synced 2025-09-13 07:45:16 -05:00
Add stuff
This commit is contained in:
61
.github/workflows/audit.yml
vendored
61
.github/workflows/audit.yml
vendored
@@ -7,13 +7,59 @@ jobs:
|
||||
lighthouse:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkount
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
with:
|
||||
hugo-version: latest
|
||||
extended: true
|
||||
|
||||
- name: Show some variables
|
||||
run: |
|
||||
echo ${{ github.event.pull_request.base.ref }}
|
||||
echo ${{ github.event.pull_request.base.sha }}
|
||||
echo ${{ github.event.base_ref }}
|
||||
echo ${{ github.event.before }}
|
||||
exit 1 # i don't want to continue for now
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}}
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||
|
||||
- name: Checkout previous commit
|
||||
run: git checkout HEAD^
|
||||
|
||||
- name: Build previous commit
|
||||
run: |
|
||||
hugo --printI18nWarnings --printPathWarnings --baseURL https://localhost
|
||||
mv public/ old/
|
||||
|
||||
- name: Checkout current commit
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- name: Build current commit
|
||||
run: |
|
||||
hugo --printI18nWarnings --printPathWarnings --baseURL https://localhost
|
||||
cp public/ new/
|
||||
# copy so that public/ stays, it will be needed for Caddy to serve
|
||||
|
||||
- name: Find changed URLs
|
||||
id: changed_urls
|
||||
env:
|
||||
SCHEME: https
|
||||
DOMAIN: localhost
|
||||
run: |
|
||||
echo "::set-output name=urls::$(./changed-urls.sh)"
|
||||
|
||||
# https://dev.to/scienta/get-changed-files-in-github-actions-1p36
|
||||
|
||||
- name: Echo changed URLs
|
||||
run: echo ${{ steps.changed_urls.outputs.urls }}
|
||||
|
||||
- name: Install Caddy
|
||||
run: |
|
||||
@@ -23,15 +69,6 @@ jobs:
|
||||
sudo apt install caddy
|
||||
sudo systemctl disable --now caddy
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
with:
|
||||
hugo-version: latest
|
||||
extended: true
|
||||
|
||||
- name: Build
|
||||
run: hugo --printI18nWarnings --printPathWarnings --baseURL https://localhost
|
||||
|
||||
- name: Compress
|
||||
run: time ./compress.sh
|
||||
|
||||
|
25
changed-urls.sh
Executable file
25
changed-urls.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
#diff -qr old/ new/ |
|
||||
# grep -v '^Only in old' |
|
||||
# sed 's/^Only in new\/: /new\//'
|
||||
# #grep -oP '(?<=Files )old.*(?= and new.* differ)' |
|
||||
# #grep 'index.html$' |
|
||||
# #sed 's/index.html$//' |
|
||||
# #sed "s/^old/${SCHEME:=http}:\/\/${DOMAIN:=example.com}/"
|
||||
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC2044
|
||||
#while IFS= read -r -d '' f; do
|
||||
# echo "$f"
|
||||
#done < <(find new/ -name '*.html' -print0)
|
||||
|
||||
#diff -qr old/ new/ |
|
||||
# grep -v '^Only in old' |
|
||||
# sed '/^Only in new/ s/^Only in new\/: /new\//'
|
||||
|
||||
diff -qrN old/ new/ |
|
||||
grep -oP '(?<=\s)new\/\S*' |
|
||||
xargs -d '\n' ls -1d 2>/dev/null |
|
||||
grep 'index.html$' |
|
||||
sed 's/index.html$//' |
|
||||
sed "s/^new/${SCHEME:=http}:\/\/${DOMAIN:=example.com}/"
|
Reference in New Issue
Block a user