-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (99 loc) · 3.25 KB
/
update-tweet.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
name: Update tweet
on:
workflow_dispatch:
push:
branches:
- main
- master
schedule:
- cron: '0 * * * *'
jobs:
update-tweet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
- name: Setup pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
run_install: false
- name: 📂 Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: 📂 Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install apt dependencies
uses: nick-fields/retry@v3
with:
max_attempts: 3
retry_on: error
timeout_minutes: 30
command: |
sudo apt-get update
sudo apt-get install -y curl fontconfig fonts-noto-cjk
fc-cache -fv
sudo apt-get install -y chromium-browser libnss3 libfreetype6 libfreetype6-dev libharfbuzz-bin ca-certificates fonts-freefont-ttf nodejs xvfb xauth dbus dbus-x11
- name: 👨🏻💻 Install dependencies
run: |
pnpm install --frozen-lockfile --prefer-frozen-lockfile
- name: Update Tweet
id: update-tweet
run: |
rm /tmp/.X*-lock || true
rm -rf data/userdata/Singleton* || true
Xvfb :99 -ac -screen 0 600x1000x16 -listen tcp &
export DISPLAY=:99
pnpm start
kill -9 "$(pgrep -f "Xvfb" | awk '{print $2}')" || true
env:
TWITTER_USERNAME: ${{ secrets.TWITTER_USERNAME }}
TWITTER_PASSWORD: ${{ secrets.TWITTER_PASSWORD }}
TWITTER_AUTH_CODE_SECRET: ${{ secrets.TWITTER_AUTH_CODE_SECRET }}
TWITTER_EMAIL_ADDRESS: ${{ secrets.TWITTER_EMAIL_ADDRESS }}
PROXY_SERVER: ${{ secrets.PROXY_SERVER }}
PROXY_USERNAME: ${{ secrets.PROXY_USERNAME }}
PROXY_PASSWORD: ${{ secrets.PROXY_PASSWORD }}
BASE_DIRECTORY: output
- name: Error handling
if: failure()
uses: Ilshidur/[email protected]
with:
args: ''
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_EMBEDS: |
[
{
"title": "Tweet Update Failed",
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"color": 16711680
}
]
- name: Upload Pages-artifact
uses: actions/upload-pages-artifact@v3
if: always()
with:
path: output
deploy:
runs-on: ubuntu-latest
needs: update-tweet
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4