-
Notifications
You must be signed in to change notification settings - Fork 7
155 lines (133 loc) · 4.98 KB
/
build.yml
File metadata and controls
155 lines (133 loc) · 4.98 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: build
concurrency:
group: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-build-${{ github.event_name }}
cancel-in-progress: true
on:
push:
branches: [master]
pull_request:
jobs:
build-kernel:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: get kernel submodule ref
id: kernel-submodule
run: echo "ref=$(git ls-tree HEAD | awk '$4 == "kernel"' | awk '{print $3}')" | tee -a $GITHUB_OUTPUT
- name: restore ccache
uses: actions/cache@v4
with:
path: .ccache
key: ccache-kernel-${{ steps.kernel-submodule.outputs.ref }}-${{ github.run_id }}
restore-keys: |
ccache-kernel-${{ steps.kernel-submodule.outputs.ref }}-
ccache-kernel-
- name: build kernel
run: ./vamos build kernel
- name: upload boot.img
uses: actions/upload-artifact@v4
with:
name: boot.img
path: build/boot.img
if-no-files-found: error
build-system:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: build system image
run: ./vamos build system
- name: upload system.erofs.img
uses: actions/upload-artifact@v4
with:
name: system.erofs.img
path: build/system.erofs.img
if-no-files-found: error
- name: upload rootfs profile
uses: actions/upload-artifact@v4
with:
name: rootfs-profile
path: |
build/rootfs-profile.json
build/rootfs-profile.md
if-no-files-found: error
release:
if: github.event_name == 'push'
needs: [build-kernel, build-system]
runs-on: ubuntu-24.04-arm
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: download boot.img
uses: actions/download-artifact@v4
with:
name: boot.img
path: build/
- name: download system.erofs.img
uses: actions/download-artifact@v4
with:
name: system.erofs.img
path: build/
- name: check deploy key
id: check-key
run: |
if [ -n "${{ secrets.VAMOS_IMAGES_DEPLOY_KEY }}" ]; then
echo "has_key=true" >> $GITHUB_OUTPUT
else
echo "has_key=false" >> $GITHUB_OUTPUT
echo "::warning::VAMOS_IMAGES_DEPLOY_KEY secret is not set — skipping image publish and release."
fi
- name: generate manifest
if: steps.check-key.outputs.has_key == 'true'
run: |
VERSION=$(cat userspace/root/VERSION)
echo "VERSION=$VERSION" >> $GITHUB_ENV
IMAGES_URL="https://github.com/${{ github.repository_owner }}/vamos-images/raw/v${VERSION}"
IMAGES_URL=$IMAGES_URL python3 tools/build/package_ota.py
- name: push images to vamos-images
if: steps.check-key.outputs.has_key == 'true'
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/vamos-images
ssh-key: ${{ secrets.VAMOS_IMAGES_DEPLOY_KEY }}
path: vamos-images
- name: commit and tag images
if: steps.check-key.outputs.has_key == 'true'
run: |
TAG="v${VERSION}"
cd vamos-images
git checkout --orphan "$TAG"
cp ../build/ota/*.img .
git add .
git -c user.name="github-actions" -c user.email="actions@github.com" \
commit -m "release images for $TAG"
git tag "$TAG"
git push origin "$TAG" --force
- name: create release
if: steps.check-key.outputs.has_key == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${VERSION}"
# Delete existing release if it exists
gh release delete "$TAG" --yes 2>/dev/null || true
git tag -d "$TAG" 2>/dev/null || true
git push origin ":refs/tags/$TAG" 2>/dev/null || true
# Create release with manifest only
gh release create "$TAG" \
--title "vamOS $TAG" \
--target "${{ github.sha }}" \
--notes "Automated release from commit ${{ github.sha }}" \
build/ota/manifest.json
- name: post setup instructions
if: steps.check-key.outputs.has_key == 'false'
run: |
echo "::warning::VAMOS_IMAGES_DEPLOY_KEY is not configured. To enable image publishing:"
echo "::warning::1. Create a ${{ github.repository_owner }}/vamos-images repo"
echo "::warning::2. Generate an SSH deploy key: ssh-keygen -t ed25519 -f vamos-images-deploy-key -N \"\""
echo "::warning::3. Add the public key to ${{ github.repository_owner }}/vamos-images as a deploy key with write access"
echo "::warning::4. Add the private key as VAMOS_IMAGES_DEPLOY_KEY secret in ${{ github.repository }}"