-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (92 loc) · 3.79 KB
/
build.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
name: Build Images
on:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
jobs:
build:
runs-on: [self-hosted, arch]
steps:
- name: Checkout Images
uses: actions/checkout@v4
with:
path: images
- name: Install dependencies
run: |
sudo pacman -Sy --noconfirm --needed \
python parted btrfs-progs \
git wget arch-install-scripts perl \
unzip gptfdisk dosfstools multipath-tools jq
yay -S --noconfirm --needed pod2man
yay -S --noconfirm --needed \
mmdebstrap debian-archive-keyring arch-test-bin
wget https://deb-mirror.fydeos.com/pacman/repo/fyde/aarch64/python-imageforge-1.1.0-2-any.pkg.tar.zst
sudo pacman -U --noconfirm python-imageforge-1.1.0-2-any.pkg.tar.zst
- name: Build Image
run: |
sudo umount -R ./work/aarch64/* || true
sudo rm -rf /var/lib/pacman/db.lck ./out ./work ./work-deb
for i in {1..3}; do
sudo python ./images/fydetab-arch/profiledef -c ./images/fydetab-arch/ -w ./work -o ./out && break
done
for i in {1..3}; do
sudo python ./images/fydetab-debian/profiledef -c ./images/fydetab-debian/ -w ./work-deb -o ./out && break
done
- name: Cleanup
if: always()
run: |
sudo umount -R ./work/aarch64/* || true
sudo rm -rf ./work ./work-deb
- name: Set current date as tag name
id: set_tag_name
run: echo "TAG_NAME=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Upload images
env:
HOST: ${{ secrets.HOST }}
KEY: ${{ secrets.KEY }}
run: |
# Save key to temp file
echo "$KEY" > /tmp/key
chmod 600 /tmp/key
for i in $(ls ./out/Debian*.img.xz); do
echo "Uploading $i"
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /tmp/key $i $HOST:/home/fydeadmin/download.fydeos.io/fydetabduo/other_os/
done
for i in $(ls ./out/Arch*.img.xz); do
echo "Uploading $i"
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /tmp/key $i $HOST:/home/fydeadmin/download.fydeos.io/fydetabduo/other_os/
done
rm /tmp/key
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
TAG_NAME: ${{ env.TAG_NAME }}
id: create_release
run: |
RELEASE_BODY=""
for i in $(ls ./out/Debian*.img.xz); do
FILENAME=$(basename $i)
URL="https://download.fydeos.io/fydetabduo/other_os/debian/$FILENAME"
SHA256=$(sha256sum $i | awk '{ print $1 }')
RELEASE_BODY+="\n$FILENAME: $URL\nsha256 for $FILENAME:\n\`\`\`\n$SHA256\n\`\`\`\n"
done
for i in $(ls ./out/Arch*.img.xz); do
FILENAME=$(basename $i)
URL="https://download.fydeos.io/fydetabduo/other_os/arch/$FILENAME"
SHA256=$(sha256sum $i | awk '{ print $1 }')
RELEASE_BODY+="\n$FILENAME: $URL\nsha256 for $FILENAME:\n\`\`\`\n$SHA256\n\`\`\`\n"
done
RELEASE_RESPONSE=$(curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"$TAG_NAME\", \"body\": \"$RELEASE_BODY\", \"draft\": false, \"prerelease\": false}" \
"https://api.github.com/repos/$REPO/releases")
RELEASE_ID=$(echo $RELEASE_RESPONSE | jq -r '.id')
if [ "$RELEASE_ID" == "null" ]; then
echo "Failed to create a release. Response: $RELEASE_RESPONSE"
exit 1
fi
- name: Clean up
run: |
rm ./out/ -rf