-
Notifications
You must be signed in to change notification settings - Fork 551
65 lines (53 loc) · 2.07 KB
/
bedrock_updater.yml
File metadata and controls
65 lines (53 loc) · 2.07 KB
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
name: Bedrock Download URLs Updater
on:
schedule:
- cron: '0 0/1 * * *' # Runs every hour
workflow_dispatch:
jobs:
check-bedrock-urls:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout AMPTemplates repository
uses: actions/checkout@v4
with:
path: AMPTemplates
- name: Install Puppeteer dependencies
run: sudo apt-get update && sudo apt-get install -y libnss3 libatk-bridge2.0-0 libxss1 libasound2t64 libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libgtk-3-0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install puppeteer and extra packages
run: npm install puppeteer puppeteer-extra puppeteer-extra-plugin-stealth
- name: Fetch current Bedrock download URLs
run: |
node AMPTemplates/scripts/get_bedrock_download_urls.mjs
echo "currentDownloadURLs=$(jq -c '.' bedrock-urls.json)" >> $GITHUB_ENV
- name: Read last known URLs
working-directory: AMPTemplates
run: |
lastDownloadURLs=$(jq -c '.' minecraft-bedrockdownloadurl.json)
echo "lastDownloadURLs=$lastDownloadURLs" >> $GITHUB_ENV
- name: Check for updates
id: check_updates
run: |
if [[ "$currentDownloadURLs" != "$lastDownloadURLs" ]]; then
echo "update_needed=true" >> $GITHUB_OUTPUT
else
echo "update_needed=false" >> $GITHUB_OUTPUT
fi
- name: Configure Git
if: steps.check_updates.outputs.update_needed == 'true'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Update minecraft-bedrockdownloadurl.json
if: steps.check_updates.outputs.update_needed == 'true'
working-directory: AMPTemplates
run: |
echo "$currentDownloadURLs" | jq --indent 4 '.' > minecraft-bedrockdownloadurl.json
git add minecraft-bedrockdownloadurl.json
git commit -m "Update Bedrock download URLs"
git push