-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (100 loc) · 3.96 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
# 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:
# 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@v2
- name: Checkout submodules
run: git submodule update --init --recursive --remote
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- 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: true
- 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: Build
run: hugo --gc --minify --cleanDestinationDir
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.TOKEN }}
publish_branch: master
force_orphan: true
publish_dir: ./public
cname: liudon.com
- 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
- 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