-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (130 loc) · 6.05 KB
/
sync_gh.yaml
File metadata and controls
139 lines (130 loc) · 6.05 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
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
name: ♻️↕️ Sync GH ↕️♻️
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
on:
workflow_dispatch:
schedule:
- cron: "0 1 * * *" #UTC 01:00 AM --> 06:45 AM NPT Everyday
#- cron: "0 2 * * Sun" #UTC 02:00 AM --> 07:45 AM NPT Sun
#- cron: "0 2 * * Wed" #UTC 02:00 AM --> 07:45 AM NPT Wed
jobs:
sync:
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
permissions:
contents: write
statuses: read
strategy:
max-parallel: 1
fail-fast: false
matrix:
include:
- runner: "ubuntu-24.04-arm"
pkg-dir: "aarch64-Linux"
repo: "bincache"
script: "https://raw.githubusercontent.com/pkgforge/bin/refs/heads/main/sync.sh"
- runner: "ubuntu-latest"
pkg-dir: "riscv64-Linux"
repo: "bincache"
script: "https://raw.githubusercontent.com/pkgforge/bin/refs/heads/main/sync.sh"
- runner: "ubuntu-latest"
pkg-dir: "x86_64-Linux"
repo: "bincache"
script: "https://raw.githubusercontent.com/pkgforge/bin/refs/heads/main/sync.sh"
- runner: "ubuntu-24.04-arm"
pkg-dir: "aarch64-Linux"
repo: "pkgcache"
script: "https://raw.githubusercontent.com/pkgforge/bin/refs/heads/main/sync.sh"
- runner: "ubuntu-latest"
pkg-dir: "riscv64-Linux"
repo: "pkgcache"
script: "https://raw.githubusercontent.com/pkgforge/bin/refs/heads/main/sync.sh"
- runner: "ubuntu-latest"
pkg-dir: "x86_64-Linux"
repo: "pkgcache"
script: "https://raw.githubusercontent.com/pkgforge/bin/refs/heads/main/sync.sh"
steps:
- name: Install Addons
run: |
#presets
set +x ; set +e
#-------------#
export DEBIAN_FRONTEND="noninteractive"
sudo apt update -y -qq
sudo apt install 7zip b3sum bc coreutils curl dos2unix fdupes jq git git-lfs moreutils wget util-linux -y -qq
sudo apt install 7zip b3sum bc coreutils curl dos2unix fdupes jq git git-lfs moreutils wget util-linux -y -qq
#bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh")
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/7z" -o "/usr/bin/7z" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/7z" -o "/usr/local/bin/7z" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/aria2" -o "/usr/local/bin/aria2" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/aria2" -o "/usr/local/bin/aria2c" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/b3sum" -o "/usr/bin/b3sum" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/b3sum" -o "/usr/local/bin/b3sum" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/eget" -o "/usr/local/bin/eget" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/jq" -o "/usr/local/bin/jq" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/oras" -o "/usr/local/bin/oras" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/ouch" -o "/usr/local/bin/ouch" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/rclone" -o "/usr/local/bin/rclone" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/rsync" -o "/usr/local/bin/rsync" &
sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/yq" -o "/usr/local/bin/yq" &
wait ; echo
sudo chmod -v 'a+x' \
"/usr/bin/7z" \
"/usr/local/bin/7z" \
"/usr/local/bin/aria2c" \
"/usr/bin/b3sum" \
"/usr/local/bin/b3sum" \
"/usr/local/bin/eget" \
"/usr/local/bin/jq" \
"/usr/local/bin/oras" \
"/usr/local/bin/ouch" \
"/usr/local/bin/rclone" \
"/usr/local/bin/rsync" \
"/usr/local/bin/yq"
continue-on-error: true
- name: Setup Env
run: |
#presets
set +x ; set +e
#-------------#
##tmp
SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}"
echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}"
#-------------#
##Git
export GH_PAGER=""
echo "GH_PAGER=${GH_PAGER}" >> "${GITHUB_ENV}"
export GIT_TERMINAL_PROMPT="0"
export GIT_USER="Azathothas"
echo "GIT_USER=${GIT_USER}" >> "${GITHUB_ENV}"
export GIT_ASKPASS="/bin/echo"
echo "GIT_ASKPASS=${GIT_ASKPASS}" >> "${GITHUB_ENV}"
gh config set prompt disabled
gh auth login --with-token < <(echo "${{ github.token }}" | tr -d '[:space:]')
git config --global "credential.helper" store
git config --global "user.email" "AjamX101@gmail.com"
git config --global "user.name" "Azathothas"
#-------------#
##User-Agent
USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_firefox_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}"
echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}"
continue-on-error: true
- name: Sync Mirror [${{ matrix.repo }} ==> ${{ matrix.pkg-dir }}]
env:
GHCR_TOKEN: "${{ github.token }}"
GITHUB_TOKEN: "${{ github.token }}"
UPSTREAM_REPO: "${{ matrix.repo }}"
run: |
#Presets
set +x ; set +e
#--------------#
curl -qfsSL "${{ matrix.script }}" -o "./sync.sh"
dos2unix --quiet "./sync.sh"
chmod +x "./sync.sh"
if [[ "${{ matrix.pkg-dir }}" == "riscv64-Linux" ]] ; then
export HOST_TRIPLET="riscv64-Linux"
fi
PARALLEL_LIMIT="$(($(nproc)+1))" bash "./sync.sh"
wait ; echo
continue-on-error: true