Skip to content

Commit de85fae

Browse files
Merge pull request #11 from RandomCoderOrg/anchor
New lunar builds and a lot more
2 parents 66ef498 + 3cc4dd2 commit de85fae

File tree

7 files changed

+385
-63
lines changed

7 files changed

+385
-63
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Build and Release
2+
on:
3+
schedule: [{cron: "1 1 1 * *"}]
4+
push:
5+
branches:
6+
- anchor
7+
8+
jobs:
9+
BuildRaw:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: docker/setup-qemu-action@v2
14+
15+
- name: Setup Dependencies
16+
run: sudo apt-get update; sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y
17+
18+
- name: checkout submoudles
19+
run: |
20+
git submodule init
21+
git submodule update
22+
- name: Build tarballs
23+
run: |
24+
sudo bash build.sh -s jammy -v raw -a arm64
25+
sudo bash build.sh -s lunar -v raw -a arm64
26+
27+
- name: upload artifacts
28+
uses: actions/upload-artifact@v3
29+
with:
30+
name: raw-tarballs
31+
path: fs-cook/out/*.tar.gz
32+
33+
Create-Release:
34+
runs-on: ubuntu-latest
35+
needs:
36+
- BuildRaw
37+
steps:
38+
- uses: actions/checkout@v2
39+
- uses: actions/download-artifact@v3
40+
with:
41+
name: raw-tarballs
42+
- name: Compute release tag
43+
run: |
44+
udroid_version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \
45+
https://github.com/RandomCoderOrg/ubuntu-on-android \
46+
| tail -n1 | cut -d / -f 3 | cut -d v -f 2- )
47+
udroid_download=$(
48+
git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \
49+
https://github.com/RandomCoderOrg/udroid-download \
50+
| tail -n1 | cut -d / -f 3
51+
)
52+
echo "VERSIONTAG=V${udroid_version}${BUILD_TYPE}PR$((${udroid_download: -2} + 1))" >> $GITHUB_ENV
53+
- name: Generate release notes
54+
run: sudo bash /home/runner/work/udroid-download/udroid-download/.github/scripts/generate-release-notes.sh
55+
- name: Create Release
56+
id: create_release
57+
uses: actions/create-release@v1
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
with:
61+
tag_name: ${{ env.VERSIONTAG }}
62+
release_name: ${{ env.VERSIONTAG }}
63+
body_path: release.md
64+
draft: false
65+
prerelease: true
66+
- name: Sleep for sometime
67+
run: sleep 60
68+
- name: Upload assets
69+
run: |
70+
set -x
71+
assets=()
72+
for asset in ./*.tar.gz; do
73+
assets+=("-a" "$asset")
74+
done
75+
tag_name="${VERSIONTAG}"
76+
hub release edit -F release.md "${assets[@]}" -m "$tag_name" "$tag_name"
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
80+
- name: update json
81+
run: |
82+
sudo apt-get install python3 -y
83+
sudo python3 gen_data/gen-update-json.py --release-tag ${{ env.VERSIONTAG }}
84+
set +e
85+
git config user.name github-actions[bot]
86+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
87+
git add distro-data.json
88+
git commit -m "AUTO: update distro-data.json"
89+
git push
90+
set -e

.github/workflows/build-and-release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
- anchor
87

98
jobs:
109
BuildRaw:

distro-data.json

Lines changed: 73 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,46 @@
11
{
2-
"suites": ["jammy", "impish", "focal"],
2+
"suites": [
3+
"jammy",
4+
"impish",
5+
"focal",
6+
"lunar"
7+
],
38
"jammy": {
4-
"varients": ["raw"],
9+
"varients": [
10+
"raw"
11+
],
512
"raw": {
6-
"arch": ["aarch64", "armv7l", "armhf", "amd64", "x86_64"],
13+
"arch": [
14+
"aarch64",
15+
"armv7l",
16+
"armhf",
17+
"amd64",
18+
"x86_64"
19+
],
720
"Name": "udroid-jammy-raw",
821
"FirendlyName": "Ubuntu Jammy (raw)",
9-
"aarch64url": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3R3/jammy-raw-arm64.tar.gz",
10-
"aarch64sha": "5e041e094eaf175a8a76ebf30f911aad043da53c9e54012eb8c4a69e27550518",
22+
"aarch64url": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3PR19/jammy-raw-arm64.tar.gz",
23+
"aarch64sha": "e2a42eaf7af74b8ba019001b9628578ee9ac503668691ef9c28434b1044ba87d",
1124
"armhfurl": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3R3/jammy-raw-armhf.tar.gz",
1225
"armhfsha": "df811e5010cbb07e05db78aa1dc1deecd3139deae8704be31a4db7d23d3efccf",
1326
"amd64url": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3R3/jammy-raw-amd64.tar.gz",
1427
"amd64sha": "2102530b19b69b0c70c26e09915c58b58486e5df53c4c8706084b11744d010d1"
1528
}
1629
},
17-
1830
"impish": {
19-
"varients": ["xfce4", "mate", "raw"],
31+
"varients": [
32+
"xfce4",
33+
"mate",
34+
"raw"
35+
],
2036
"raw": {
21-
"arch": ["aarch64", "armv7l", "armhf", "amd64", "x86_64"],
37+
"arch": [
38+
"aarch64",
39+
"armv7l",
40+
"armhf",
41+
"amd64",
42+
"x86_64"
43+
],
2244
"Name": "udroid-impish-raw",
2345
"FirendlyName": "Ubuntu Impish (raw)",
2446
"aarch64url": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3R3/impish-raw-arm64.tar.gz",
@@ -29,7 +51,11 @@
2951
"amd64sha": "c5ce02ed7be92537bb1e2bcc5eb2ab588afc50c147972e1336a2a9c290813245"
3052
},
3153
"xfce4": {
32-
"arch": ["aarch64", "amd64", "x86_64"],
54+
"arch": [
55+
"aarch64",
56+
"amd64",
57+
"x86_64"
58+
],
3359
"Name": "udroid-impish-xfce4",
3460
"FirendlyName": "Ubuntu Impish (xfce4)",
3561
"aarch64url": "https://github.com/RandomCoderOrg/ubuntu-on-android/releases/download/v3/udroid-arm64-xfce4-V3MBB2.tar.gz",
@@ -38,17 +64,26 @@
3864
"amd64sha": "88a5f5f079aef994b6d5b2e3df773aa875ed2157d1f00c8fda504bda9f01e680"
3965
},
4066
"mate": {
41-
"arch": ["aarch64"],
67+
"arch": [
68+
"aarch64"
69+
],
4270
"Name": "udroid-impish-mate",
4371
"FirendlyName": "Ubuntu Impish (mate)",
4472
"aarch64url": "https://github.com/RandomCoderOrg/ubuntu-on-android/releases/download/v3/udroid-mate-arm64-betav2.tar.gz",
4573
"aarch64sha": "3069a4c40c6d2982e943216f46ce52516a3c8d5ae29bdde633237ddd3748c88b"
4674
}
4775
},
4876
"focal": {
49-
"varients": ["xfce4"],
50-
"xfce4":{
51-
"arch": ["aarch64", "armv7l", "armv8l", "armhf"],
77+
"varients": [
78+
"xfce4"
79+
],
80+
"xfce4": {
81+
"arch": [
82+
"aarch64",
83+
"armv7l",
84+
"armv8l",
85+
"armhf"
86+
],
5287
"Name": "udroid-focal-xfce4",
5388
"FirendlyName": "Ubuntu Focal (xfce4)",
5489
"aarch64url": "https://github.com/RandomCoderOrg/ubuntu-on-android/releases/download/v02-xfce4/hippo-arm64-v02-xfce4.tar.gz",
@@ -58,9 +93,16 @@
5893
}
5994
},
6095
"kinetic": {
61-
"varients": ["raw"],
96+
"varients": [
97+
"raw"
98+
],
6299
"raw": {
63-
"arch": ["aarch64", "armv7l", "armv8l", "armhf"],
100+
"arch": [
101+
"aarch64",
102+
"armv7l",
103+
"armv8l",
104+
"armhf"
105+
],
64106
"Name": "udroid-kinetic-raw",
65107
"FirendlyName": "Ubuntu Kinetic (raw)",
66108
"aarch64url": "",
@@ -70,5 +112,20 @@
70112
"x86_64url": "",
71113
"x86_64sha": ""
72114
}
115+
},
116+
"lunar": {
117+
"varients": [
118+
"raw"
119+
],
120+
"raw": {
121+
"arch": [
122+
"arm64",
123+
"aarch64"
124+
],
125+
"Name": "lunar-raw",
126+
"FirendlyName": "lunar raw",
127+
"aarch64url": "https://github.com/RandomCoderOrg/udroid-download/releases/download/V3PR19/lunar-raw-arm64.tar.gz",
128+
"aarch64sha": "d4332a358308e180949d9c25a29e78204440d4d0c9c3bff6eed4bcd93d1dca34"
129+
}
73130
}
74-
}
131+
}

gen_data/arch.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
def translated_arch() -> dict:
3+
"""System architectures translated to deb package architecture names
4+
5+
Returns:
6+
dict: dictionary of arch names
7+
"""
8+
# TODO Need improve above docstring
9+
10+
# SystemArchitecture:PackageArchitecture
11+
return dict(
12+
{
13+
"armhf": "armhf",
14+
"arm": "armhf",
15+
"arm64": "aarch64",
16+
"aarch64": "aarch64",
17+
"amd64": "amd64",
18+
"x86_64": "amd64"
19+
}
20+
)
21+
22+
23+
24+
def ReverseTranslate() -> dict:
25+
StoPdict = translated_arch();
26+
PtoSdict = {}
27+
28+
for SysArch,PakArch in zip(StoPdict.keys(),StoPdict.values()):
29+
if PakArch in PtoSdict:
30+
PtoSdict[PakArch].append(SysArch)
31+
else:
32+
PtoSdict[PakArch] = [SysArch]
33+
34+
return PtoSdict

gen_data/gen-update-json.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,29 @@
22
import json
33
import optparse
44
import utils
5+
import arch
56

67
GIT_ROOT = os.popen("git rev-parse --show-toplevel").read().strip()
7-
DIR = "fs-cook/out"
8+
DIR = "."
89
VERBOSE = False
910
JSON_CONF = f"{GIT_ROOT}/distro-data.json"
1011

1112
def update_json_conf(file) -> None:
1213
data = strip_info(file)
1314
jdata = json.load(open(JSON_CONF, 'r'))
1415

16+
# resolv data
17+
jdata = utils.resolv_data(jdata, data[0], data[1], [data[2]])
18+
1519
# update url
16-
jdata[data[0]][data[1]][f"{data[2]}Url"] = get_release_url(
17-
RELEASE_TAG, data[3])
20+
jdata[data[0]] \
21+
[data[1]] \
22+
[f"{data[2]}url"] = get_release_url(RELEASE_TAG, data[3])
1823

1924
# update sha
20-
jdata[data[0]][data[1]][f"{data[2]}sha"] = os.popen(
21-
f"sha256sum {DIR}/{data[3]}").read().split()[0]
25+
jdata[data[0]] \
26+
[data[1]] \
27+
[f"{data[2]}sha"] = os.popen(f"sha256sum {file}").read().split()[0]
2228

2329
# update JSON_CONF
2430
file = open(JSON_CONF, 'w')
@@ -29,25 +35,18 @@ def strip_info(file):
2935
name = os.path.splitext(basename)[0]
3036
name = os.path.splitext(name)[0]
3137

32-
sp = name.split("-")
33-
ar = {
34-
"armhf": "armhf",
35-
"arm": "armhf",
36-
"arm64": "aarch64",
37-
"aarch64": "aarch64",
38-
"amd64": "amd64",
39-
"x86_64": "amd64"
40-
}
38+
sp = name.split("-")
39+
StoPdict = arch.translated_arch()
4140

4241
suite = sp[0]
4342
variant = sp[1]
44-
arch = ar[sp[2]]
45-
46-
return [suite, variant, arch, basename]
43+
packageArchitecture = StoPdict[sp[2]]
44+
45+
return [suite, variant, packageArchitecture, basename]
4746

4847
def get_release_url(release_tag, file) -> str:
49-
repo="https://github.com/RandomCoderOrg/udroid-download"
50-
url="{}/releases/download/{}/{}".format(repo, release_tag, file)
48+
repo ="https://github.com/RandomCoderOrg/udroid-download"
49+
url ="{}/releases/download/{}/{}".format(repo, release_tag, file)
5150
return url
5251

5352
if __name__ == '__main__':
@@ -60,8 +59,10 @@ def get_release_url(release_tag, file) -> str:
6059
options, args = parser.parse_args()
6160
# get release tag
6261

62+
from utils import getfilesR
63+
6364
RELEASE_TAG = options.release_tag
64-
for file in os.listdir(DIR):
65+
for file in getfilesR(DIR):
6566
if file.endswith(".tar.gz"):
6667
update_json_conf(file)
6768

0 commit comments

Comments
 (0)