-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (162 loc) · 6.13 KB
/
release.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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: droidian rootfs-builder
on:
workflow_dispatch:
push:
schedule:
- cron: "59 23 * * *"
jobs:
once:
runs-on: ubuntu-20.04
name: Generate matrix
outputs:
matrix: ${{ steps.gen-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate matrix
id: gen-matrix
run: |
JOBS="$(./generate_device_recipe.py --matrix)"
echo "matrix=${JOBS}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-20.04
needs: once
strategy:
fail-fast: true
matrix:
config: ${{ fromJson(needs.once.outputs.matrix) }}
name: ${{ matrix.config.job_name }}
steps:
- name: Get current date
run: echo "current_date=$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Set suffix
run: echo "release_suffix=_${{ env.current_date }}" >> $GITHUB_ENV
- name: Set nightly version
if: startsWith(github.ref, 'refs/tags/droidian') != true
run: echo "DROIDIAN_VERSION=next" >> $GITHUB_ENV
- name: Set version
if: startsWith(github.ref, 'refs/tags/droidian') == true
run: echo "DROIDIAN_VERSION=$(echo ${{ github.ref }} | rev | cut -d'/' -f1 | rev)" >> $GITHUB_ENV
- name: Set identifier
run: echo "DROIDIAN_IDENTIFIER=${{ matrix.config.product }}-${{ matrix.config.arch }}-${{ matrix.config.edition }}-${{ matrix.config.variant }}-${{ matrix.config.apilevel }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
submodules: 'recursive'
- name: Checkout submodules
run: git submodule update --init --recursive
- name: QEMU set-up
uses: docker/setup-qemu-action@v3
- name: Create build dir
run: mkdir -p /tmp/buildd-results
- name: Pull container
run: docker pull quay.io/droidian/rootfs-builder:next-amd64
- name: Start Container
run: echo CONTAINER_HASH=$(docker run --detach --privileged -v /tmp/buildd-results:/buildd/out -v /dev:/host-dev -v /sys/fs/cgroup:/sys/fs/cgroup -v ${PWD}:/buildd/sources --security-opt seccomp:unconfined quay.io/droidian/rootfs-builder:next-amd64 /sbin/init) >> $GITHUB_ENV
- name: Build rootfs
run: |
docker exec $CONTAINER_HASH /bin/sh -c 'cd /buildd/sources; DROIDIAN_VERSION="${{ env.DROIDIAN_VERSION }}" ./generate_device_recipe.py ${{ matrix.config.product }} ${{ matrix.config.arch }} ${{ matrix.config.edition }} ${{ matrix.config.variant }} ${{ matrix.config.apilevel }} && debos --disable-fakemachine generated/droidian.yaml'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: droidian-out-${{ matrix.config.product }}-${{ matrix.config.arch }}-${{ matrix.config.edition }}-${{ matrix.config.variant }}-${{ matrix.config.apilevel }}
path: out/*
if-no-files-found: error
retention-days: 1
prepare:
runs-on: ubuntu-20.04
name: Create GitHub release
needs: build
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}${{ steps.create_nightly.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free up some storage
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- name: Delete old bronco release
uses: dev-drprasad/delete-tag-and-release@v0.2.1
if: startsWith(github.ref, 'refs/tags/droidian') != true
with:
delete_release: true # default: false
tag_name: bronco # tag name to delete
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tag snapshot
if: startsWith(github.ref, 'refs/tags/droidian') != true
uses: tvdias/github-tagger@v0.0.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tag: bronco
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: droidian-out
- name: Create SHA256SUMS
run: |
cd droidian-out
for x in droidian-out-*; do
cd $x
sha256sum * >> ../SHA256SUMS
cd ..
done
- name: Create stable release (drafted)
id: create_release
if: startsWith(github.ref, 'refs/tags/droidian')
uses: softprops/action-gh-release@v2
with:
files: droidian-out/SHA256SUMS
tag_name: ${{ github.ref }}
draft: true
prerelease: false
- name: Create bronco release
id: create_bronco
if: startsWith(github.ref, 'refs/tags/droidian') != true
uses: softprops/action-gh-release@v2
with:
files: droidian-out/SHA256SUMS
tag_name: bronco
draft: false
prerelease: true
publish:
runs-on: ubuntu-20.04
needs: [once, prepare]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}${{ steps.create_nightly.outputs.upload_url }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.once.outputs.matrix) }}
name: Publish ${{ matrix.config.job_name }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: droidian-out-${{ matrix.config.product }}-${{ matrix.config.arch }}-${{ matrix.config.edition }}-${{ matrix.config.variant }}-${{ matrix.config.apilevel }}
path: droidian-out
- name: Create stable release (drafted)
id: create_release
if: startsWith(github.ref, 'refs/tags/droidian')
uses: softprops/action-gh-release@v2
with:
files: droidian-out/*
tag_name: ${{ github.ref }}
draft: true
prerelease: false
- name: Create bronco release
id: create_bronco
if: startsWith(github.ref, 'refs/tags/droidian') != true
uses: softprops/action-gh-release@v2
with:
files: droidian-out/*
tag_name: bronco
draft: false
prerelease: true