Skip to content

Commit 772569b

Browse files
authored
Try to make CodeFactor A (#4)
* Try to make CodeFactor A * Fix syntax issue of `build-and-release.yml`
1 parent 6d38305 commit 772569b

File tree

3 files changed

+28
-24
lines changed

3 files changed

+28
-24
lines changed

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
push:
66
branches:
77
- main
8-
8+
99
jobs:
1010
suite-build:
1111
runs-on: ubuntu-latest # buildjet-4vcpu-ubuntu-2204
@@ -16,11 +16,11 @@ jobs:
1616
suite: [ jammy, focal, kinetic, lunar ]
1717
variant: [ raw, lxqtRaw, kdeRaw, gnomeRaw, mateRaw ]
1818
architecture: [ armhf ] #, arm64 ] #, amd64 ]
19-
19+
2020
steps:
2121
- uses: actions/checkout@v3
2222
- uses: docker/setup-qemu-action@v2
23-
23+
2424
- name: ✅ Pre-Build Checks
2525
run: |
2626
if [ -d "suites/${{ matrix.suite }}" ]; then
@@ -32,17 +32,17 @@ jobs:
3232
echo "Error: ${{ matrix.suite }} is not a valid suite!"
3333
exit 1
3434
fi
35-
35+
3636
- name: ⤵️ Install Dependencies
3737
run: |
3838
sudo apt-get update
3939
sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y
40-
40+
4141
- name: 📥 Download Submodules
4242
run: |
4343
git submodule init
4444
git submodule update
45-
45+
4646
- name: 🛠️ Build ${{ matrix.suite }}-${{ matrix.variant }}-${{ matrix.architecture }}
4747
run: sudo bash build.sh -s ${{ matrix.suite }} -v ${{ matrix.variant }} -a ${{ matrix.architecture }}
4848

@@ -51,26 +51,26 @@ jobs:
5151
with:
5252
name: ${{ matrix.suite }}-${{ matrix.architecture }}-tarballs
5353
path: fs-cook/out/${{ matrix.suite }}-${{ matrix.variant }}-${{ matrix.architecture }}.tar.gz
54-
54+
5555
create-release:
5656
runs-on: ubuntu-latest
57-
57+
5858
if: ${{ always() }}
5959
needs: suite-build
60-
60+
6161
steps:
6262
- uses: actions/checkout@v3
6363
with:
6464
token: ${{ secrets.RELEASE_TOKEN }}
65-
65+
6666
- name: 📥 Download All Tarballs
6767
uses: actions/download-artifact@v3
68-
68+
6969
# Debug Purposes
7070
- name: List Tarballs
7171
run: |
7272
ls *-*/*.tar.gz
73-
73+
7474
- name: 🏷 Generate Release Tag
7575
run: |
7676
udroid_version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \
@@ -87,7 +87,7 @@ jobs:
8787
8888
- name: 📝 Generate Release Notes
8989
run: sudo bash /home/runner/work/udroid-download/udroid-download/.github/scripts/generate-release-notes.sh
90-
90+
9191
- name: ⬆️ Upload Suite Tarballs
9292
uses: ncipollo/release-action@v1
9393
with:
@@ -99,10 +99,10 @@ jobs:
9999
prerelease: false
100100
artifacts: '*-*-tarballs/*.tar.gz'
101101
makeLatest: true
102-
102+
103103
- name: ⚙️ Generate New distro-data.json
104104
run: sudo python3 gen_data/gen-update-json.py --release-tag ${{ env.VERSIONTAG }}
105-
105+
106106
- name: ⚙️ Update distro-data.json
107107
uses: stefanzweifel/git-auto-commit-action@v4
108108
with:

gen_data/gen-update-json.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import utils
55
import arch
66

7-
GIT_ROOT = os.popen("git rev-parse --show-toplevel").read().strip()
8-
GIT_REMOTE_URL = os.popen("git config --get remote.origin.url").read().strip()
9-
DIR = "."
10-
VERBOSE = False
11-
JSON_CONF = f"{GIT_ROOT}/distro-data.json"
7+
GIT_ROOT = utils.Popen("git rev-parse --show-toplevel")
8+
GIT_REMOTE_URL = utils.Popen("git config --get remote.origin.url")
9+
DIR = "."
10+
VERBOSE = False
11+
JSON_CONF = f"{GIT_ROOT}/distro-data.json"
1212

1313
def update_json_conf(file) -> None:
1414
data = strip_info(file)
@@ -36,17 +36,17 @@ def strip_info(file):
3636
name = os.path.splitext(basename)[0]
3737
name = os.path.splitext(name)[0]
3838

39-
sp = name.split("-")
39+
sp = name.split("-")
4040
StoPdict = arch.translated_arch()
4141

42-
suite = sp[0]
42+
suite = sp[0]
4343
variant = sp[1]
44-
packageArchitecture = StoPdict[sp[2]]
44+
packageArchitecture = StoPdict[sp[2]]
4545

4646
return [suite, variant, packageArchitecture, basename]
4747

4848
def get_release_url(release_tag, file) -> str:
49-
url ="{}/releases/download/{}/{}".format(GIT_REMOTE_URL, release_tag, file)
49+
url = "{}/releases/download/{}/{}".format(GIT_REMOTE_URL, release_tag, file)
5050
return url
5151

5252
if __name__ == '__main__':

gen_data/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import subprocess
23

34
def add_suite(JsonFile: dict, suite: str) -> None:
45
""" Add suite to the JsonFile
@@ -82,3 +83,6 @@ def getfilesR(path: str) -> list:
8283
files.append(os.path.join(r, file))
8384

8485
return files
86+
87+
def Popen(cmd: str) -> str:
88+
return subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().strip()

0 commit comments

Comments
 (0)