forked from EmulatorJS/EmulatorJS
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (69 loc) · 2.4 KB
/
stable.yml
File metadata and controls
69 lines (69 loc) · 2.4 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
66
67
68
69
name: Make Stable Folder On EmulatorJS CDN
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
run:
if: github.repository == 'EmulatorJS/EmulatorJS'
runs-on: emulatorjs-server
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Variables
run: |
cd /mnt/HDD/public/
wget -q "https://api.github.com/repos/EmulatorJS/EmulatorJS/releases/latest" -O .tmp.json
version=$(jq -r '.tag_name' .tmp.json)
download_url=$(jq -r '.assets[0].browser_download_url' .tmp.json)
name=$(jq -r '.assets[0].name' .tmp.json)
old_version=$(jq -r '.github' versions.json)
v_version="$version"
if [[ $version == v* ]]; then
version="${version:1}"
fi
rm .tmp.json
echo "VERSION=$version" >> $GITHUB_ENV
echo "DOWNLOAD_URL=$download_url" >> $GITHUB_ENV
echo "NAME=$name" >> $GITHUB_ENV
echo "OLD_VERSION=$old_version" >> $GITHUB_ENV
echo "V_VERSION=$v_version" >> $GITHUB_ENV
- name: Download Stable
run: |
cd /mnt/HDD/public/
mkdir -p ".stable"
wget -q "$DOWNLOAD_URL" -O ".stable/$NAME"
- name: Extract Stable
run: |
cd /mnt/HDD/public/.stable/
7z x "$NAME"
- name: Move Versions
run: |
cd /mnt/HDD/public/
mv ".stable/$NAME" releases/
mv "$OLD_VERSION" "$VERSION"
mv stable "$OLD_VERSION"
mv .stable stable
jq --arg version "$VERSION" '.github = $version' versions.json | sponge versions.json
- name: Set Permissions
run: |
cd /mnt/HDD/public
chmod -R 775 stable/
- name: Update Stable Cores
run: |
rsync -a --delete /mnt/HDD/public/stable/data/cores/ /mnt/HDD/public/.EmulatorJS/data/cores/
- name: Zip Stable
run: |
cd /mnt/HDD/public/stable/data/
zip emulator.min.zip emulator.min.js emulator.min.css
- name: Update Version
run: |
cd /mnt/HDD/public/
jq --arg old_version "$OLD_VERSION" '.versions += {($old_version): ($old_version + "/")}' versions.json | sponge versions.json
- name: Clean Up
run: |
cd /mnt/HDD/public/
rm -f "$OLD_VERSION/data/emulator.min.zip"
rm -rf "$OLD_VERSION/node_modules/"