-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (104 loc) · 3.76 KB
/
build-self-hosted.yml
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
name: Build and Release (Self-hosted)
on:
push:
tags:
- '*'
jobs:
build:
name: Build Images
permissions: write-all
runs-on: self-hosted
outputs:
regular_build: ${{ steps.regular_build.outputs.success }}
steps:
- name: Install and update dependencies
run: |
sudo apt update
sudo apt upgrade -y
sudo apt install -y gcc make git unzip wget xz-utils bc gperf zip g++ xfonts-utils xsltproc \
openjdk-11-jre-headless libparse-yapp-perl libxml-parser-perl patchutils lzop rdfind dotnet-sdk-9.0
- name: Update repository
working-directory: /home/bubbles/TKMM-NX
run: |
git fetch --all --tags -f
git checkout ${{ github.ref_name }} -f
- name: Build regular image
id: regular_build
working-directory: /home/bubbles/TKMM-NX
run: |
mkdir -p releases
rm -rf target/*
THREADCOUNT=20 DISTRO=TKMM PROJECT=L4T DEVICE=Switch ARCH=aarch64 make image
for file in target/TKMM-Switch.*; do
if [ -f "$file" ]; then
commit=$(echo "$file" | sed -E 's/.*-([a-f0-9]+)\.[^.]+(\.[^.]+)?$/\1/')
if [[ "$file" == *.tar.sha256 ]]; then
mv "$file" "releases/TKMM-NX-${{ github.ref_name }}-${commit}.tar.sha256"
else
ext="${file##*.}"
mv "$file" "releases/TKMM-NX-${{ github.ref_name }}-${commit}.${ext}"
fi
fi
done
echo "success=true" >> $GITHUB_OUTPUT
- name: Build debug image
id: debug_build
working-directory: /home/bubbles/TKMM-NX
continue-on-error: true
run: |
mkdir -p debug
THREADCOUNT=20 DISTRO=TKMM PROJECT=L4T DEVICE=Switch ARCH=aarch64 DEVMODE=enabled make image
for file in target/TKMM-Switch.*; do
if [ -f "$file" ]; then
commit=$(echo "$file" | sed -E 's/.*-([a-f0-9]+)\.[^.]+(\.[^.]+)?$/\1/')
if [[ "$file" == *.tar.sha256 ]]; then
mv "$file" "debug/TKMM-NX-${{ github.ref_name }}-DEBUG-${commit}.tar.sha256"
else
ext="${file##*.}"
mv "$file" "debug/TKMM-NX-${{ github.ref_name }}-DEBUG-${commit}.${ext}"
fi
fi
done
release:
needs: build
if: needs.build.outputs.regular_build == 'true'
name: Create Release
runs-on: ubuntu-latest
permissions: write-all
outputs:
release: ${{ steps.release.outputs.upload_url }}
steps:
- name: Create Release
uses: actions/create-release@v1
id: release
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
tag_name: ${{ github.ref_name }}
release_name: TKMM-NX - ${{ github.ref_name }}
draft: false
prerelease: false
upload:
name: Upload Images
needs: [build, release]
permissions: write-all
runs-on: self-hosted
steps:
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
tag_name: ${{ github.ref_name }}
files: |
/home/bubbles/TKMM-NX/releases/*
/home/bubbles/TKMM-NX/debug/*
- name: Upload to mirror
working-directory: /home/bubbles/TKMM-NX
run: |
scp -i ~/.ssh/github_runner_sftp_key releases/* [email protected]:/var/www/html/repo/.tkmm-nx/Releases
scp -i ~/.ssh/github_runner_sftp_key debug/* [email protected]:/var/www/html/repo/.tkmm-nx/Debug
- name: Cleanup Folders
run: |
rm -rf /home/bubbles/TKMM-NX/releases
rm -rf /home/bubbles/TKMM-NX/debug