-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (125 loc) · 5.28 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the code branch
push:
branches: [ code ]
pull_request:
branches: [ code ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive --remote
- name: Get twikoo version
id: twikoo
run: |
version=$(curl -s https://raw.githubusercontent.com/Liudon/twikoo-netlify/main/package.json | jq -r '.dependencies."twikoo-netlify"')
echo "Twikoo version: $version"
echo "twikoo_version=$version" >> $GITHUB_OUTPUT
- name: Update config.yml version
uses: fjogeleit/yaml-update-action@main
with:
valueFile: 'config.yml'
propertyPath: 'params.twikoo.version'
value: ${{ steps.twikoo.outputs.twikoo_version }}
commitChange: false
# - name: Compress Image
# run: |
# wget 'https://github.com/kornelski/cavif-rs/releases/download/v1.5.4/cavif-1.5.4.zip'
# unzip cavif-1.5.4.zip
# sudo mv ./linux-generic/cavif /bin
# # find ./content/posts/ -type f \( -name "*.jpg" -o -name "*.png" -o -name "*.jpeg" \) -exec cavif {} \;
- name: Compress Image
run: |
sudo apt-get update
sudo apt-get install -y build-essential libx11-dev libxext-dev zlib1g-dev \
libpng-dev libjpeg-dev libfreetype6-dev libxml2-dev liblcms2-dev \
libopenexr-dev libtiff-dev libraw-dev libheif-dev libde265-dev \
libfftw3-dev libglib2.0-dev libwebp-dev
wget https://download.imagemagick.org/ImageMagick/download/ImageMagick.tar.gz
tar xvzf ImageMagick.tar.gz
cd ImageMagick-7.*
./configure
make
sudo make install
sudo ldconfig /usr/local/lib
magick --version
cd ../
find ./content/posts/ -type f \( -name "*.jpg" -o -name "*.png" -o -name "*.jpeg" \) -exec magick mogrify -pointsize 48 -fill "#909090" -font ./static/ArchitectsDaughter-Regular.ttf -gravity south -annotate +0+20 "@liudon\nhttps://liudon.com" -resize 1080x\> {} \;
find ./content/posts/ -type f \( -name "*.jpg" -o -name "*.png" -o -name "*.jpeg" \) -exec magick {} -quality 75 -define webp:image-hint=photo {}_1080x.webp \;
find ./content/posts/ -type f \( -name "*.jpg" -o -name "*.png" -o -name "*.jpeg" \) -exec magick {} {}_1080x.avif \;
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'
extended: true
- name: Build
run: |
ls -l ./
hugo --gc --minify --cleanDestinationDir
- name: Push
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.TOKEN }}
publish_branch: master
force_orphan: true
publish_dir: ./public
cname: liudon.com
- name: Easyindex
run: |
echo '${{ secrets.GOOGLE_INDEXING_API_TOKEN }}' > ./credentials.json
touch ./url.csv
echo "\"notification_type\",\"url\"" >> ./url.csv # Headers line
echo "\"URL_UPDATED\",\"https://liudon.com/\"" >> ./url.csv # ADD URL
echo "\"URL_UPDATED\",\"https://liudon.com/sitemap.xml\"" >> ./url.csv # ADD URL
curl -s -L https://github.com/usk81/easyindex-cli/releases/download/v1.0.6/easyindex-cli_1.0.6_linux_amd64.tar.gz | tar xz
chmod +x ./easyindex-cli
./easyindex-cli google -d -c ./url.csv
- name: Generate robots.txt
run: |
echo "User-agent: *" > ./public/robots.txt
echo "Disallow: /" >> ./public/robots.txt
- name: Connect to ssh in BG
timeout-minutes: 2
run: |
echo "${{ secrets.SSHKEY }}" > ../privkey
chmod 600 ../privkey
ssh -o StrictHostKeyChecking=no ${{ secrets.SSHHOST }} -i ../privkey -L 5001:localhost:5001 -fTN
- name: IPFS upload
uses: filebase/ipfs-action@master
id: deploy
timeout-minutes: 2
with:
path: ./public
service: ipfs
verbose: true
host: localhost
port: 5001
protocol: http
key: ipfs-action
- name: IPFS upload to filebase
uses: filebase/ipfs-action@master
with:
path: ./public
service: filebase
pinName: ipfs-action
filebaseBucket: ${{ secrets.FILEBASE_BUCKET }}
filebaseKey: ${{ secrets.FILEBASE_KEY }}
filebaseSecret: ${{ secrets.FILEBASE_SECRET }}
key: ipfs-action