18
18
19
19
workflow_dispatch :
20
20
21
+
22
+ # Allow to stop obsolete workflows
23
+ concurrency :
24
+ group : ci-buildraspios-${{ github.ref }}-1
25
+ cancel-in-progress : true
26
+
27
+ env :
28
+ DOWNLOAD_URL_CHECKSUM : " https://downloads.raspberrypi.org/raspios_lite_armhf_latest.sha256"
29
+ DOWNLOAD_URL_IMAGE : " https://downloads.raspberrypi.org/raspios_lite_armhf_latest.torrent"
30
+ FILENAME_CHECKSUM : " raspios_lite_armhf_latest.sha256"
31
+
21
32
jobs :
22
33
raspiosbuild :
23
34
runs-on : ubuntu-latest
@@ -39,27 +50,70 @@ jobs:
39
50
path : repository
40
51
submodules : true
41
52
53
+ - name : Raspberry Pi OS Checksum
54
+ id : raspios-checksum
55
+ run : |
56
+ cd repository/src/image
57
+ wget -O $FILENAME_CHECKSUM $DOWNLOAD_URL_CHECKSUM
58
+ FILE_CONTENT=$(head -n 1 $FILENAME_CHECKSUM)
59
+ CHECKSUM=$(echo $FILE_CONTENT | cut -d' ' -f1)
60
+ echo "::set-output name=CHECKSUM::$CHECKSUM"
61
+
62
+ - name : Cache Raspberry Pi OS Source Image
63
+ id : cache-source-image
64
+ uses : actions/cache@v3
65
+ with :
66
+ path : repository/src/image/*.img.xz
67
+ key : ${{ runner.os }}-${{ steps.raspios-checksum.outputs.CHECKSUM }}
68
+
42
69
- name : Download Raspberry Pi OS Source Image
43
- run : aria2c -d repository/src/image/ --seed-time=0 https://downloads.raspberrypi.org/raspios_oldstable_lite_armhf_latest.torrent
70
+ if : steps.cache-source-image.outputs.cache-hit != 'true'
71
+ run : aria2c -d repository/src/image --seed-time=0 $DOWNLOAD_URL_IMAGE
44
72
45
73
- name : Comparing Checksums
46
74
run : |
47
75
cd repository/src/image
48
- curl -JL https://downloads.raspberrypi.org/raspios_oldstable_lite_armhf_latest.sha256 | awk '{print $1" "$2}' | sha256sum -c
76
+ cat $FILENAME_CHECKSUM | awk '{print $1" "$2}' | sha256sum -c
49
77
50
78
- name : Update CustomPiOS Paths
51
79
run : cd repository/src && ../../CustomPiOS/src/update-custompios-paths
52
80
53
81
- name : Build Image
54
82
run : sudo modprobe loop && cd repository/src && sudo bash -x ./build_dist
55
83
56
- - name : Copy output image
57
- run : cp ${{ github.workspace }}/repository/src/workspace/*-raspios-*-lite.img mainsailos-raspios-lite-latest.img
84
+ - name : Copy output
85
+ id : copy-image
86
+ run : |
87
+ source repository/src/config
88
+ NOW=$(date +"%Y-%m-%d")
89
+ IMAGE=$NOW-mainsailos-$DIST_VERSION
58
90
59
- - name : Compress the image
60
- run : zip mainsailos-raspios-lite-latest.zip mainsailos-raspios-lite-latest.img
91
+ cp repository/src/workspace/*.img $IMAGE.img
92
+
93
+ echo "::set-output name=image::$IMAGE"
94
+
95
+ - name : Compressing Image
96
+ run : xz -efkvz ${{ steps.copy-image.outputs.image }}.img
97
+
98
+ - name : Calculating checksums
99
+ run : |
100
+ sha256sum ${{ steps.copy-image.outputs.image }}.img > ${{ steps.copy-image.outputs.image }}.img.sha256
101
+ sha256sum ${{ steps.copy-image.outputs.image }}.img.xz > ${{ steps.copy-image.outputs.image }}.img.xz.sha256
102
+
103
+ - name : Upload Compressed Image
104
+ uses : actions/upload-artifact@v3
105
+ with :
106
+ name : ${{ steps.copy-image.outputs.image }}.img.xz
107
+ path : ${{ steps.copy-image.outputs.image }}.img.xz
108
+
109
+ - name : Upload Compressed Image Checksum
110
+ uses : actions/upload-artifact@v3
111
+ with :
112
+ name : ${{ steps.copy-image.outputs.image }}.img.xz.sha256
113
+ path : ${{ steps.copy-image.outputs.image }}.img.xz.sha256
61
114
62
- - uses : actions/upload-artifact@v2
115
+ - name : Upload Image Checksum
116
+ uses : actions/upload-artifact@v3
63
117
with :
64
- name : mainsailos-raspios-lite-latest.zip
65
- path : mainsailos-raspios-lite-latest.zip
118
+ name : ${{ steps.copy-image.outputs.image }}.img.sha256
119
+ path : ${{ steps.copy-image.outputs.image }}.img.sha256
0 commit comments