-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (136 loc) · 4.49 KB
/
build-bootstraps.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
name: Build bootstrap archives
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
strategy:
# TODO look into sharing matrix between jobs
matrix:
arch:
- arm-vfpv3-d16
# TODO make this auto generated by a job
# This is the bare minimum that can build all bootstrap packages in parallel
package:
- apt
- bash
- command-not-found
- dash
- debianutils
- dos2unix
- ed
- inetutils
- lsof
- nano
- net-tools
- patch
- proot
- termux-keyring
- unzip
runs-on: ubuntu-22.04
steps:
- name: Git clone
uses: actions/checkout@v3
with:
submodules: true
- name: Build bootstrap packages
run: ./build-package.sh ${{ matrix.arch }} ${{ matrix.package }}
- name: Packing and calculate checksum
run: |
# Files containing certain symbols (e.g. ":") will cause failure in actions/upload-artifact.
# Archiving *.deb files in a tarball to avoid issues with uploading.
tar cf build.${{ matrix.arch }}.${{ matrix.package }}.${{ github.sha }}.tar output
find ./output -name "*.deb" -exec sha256sum "{}" \; | sort -k2
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: build.${{ matrix.arch }}.${{ matrix.package }}.${{ github.sha }}
path: build.${{ matrix.arch }}.${{ matrix.package }}.${{ github.sha }}.tar
generate:
strategy:
# TODO look into sharing matrix between jobs
matrix:
arch:
- arm-vfpv3-d16
needs: build
runs-on: ubuntu-latest
steps:
- name: Git clone
uses: actions/checkout@v3
with:
submodules: true
- name: Fetch artifacts
uses: actions/download-artifact@v3
with:
path: ./
- name: Extract artifacts
run: |
for archive in build.${{ matrix.arch }}.*/build.${{ matrix.arch }}.*.tar; do
echo "[*] Extracting archive $archive..."
tar xvf "$archive"
done
- name: Generate bootstrap archives
run: ./generate-bootstraps.sh ${{ matrix.arch }}
- name: Calculate checksum
run: find . -name "*.zip" -exec sha256sum "{}" \; | sort -k2
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: generate.${{ matrix.arch }}.${{ github.sha }}
path: "*.zip"
publish:
if: github.event_name != 'pull_request'
strategy:
# TODO look into sharing matrix between jobs
matrix:
arch:
- arm-vfpv3-d16
needs: generate
runs-on: ubuntu-latest
steps:
- name: Git clone
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch bootstrap archives
uses: actions/download-artifact@v3
with:
name: generate.${{ matrix.arch }}.${{ github.sha }}
path: ./
- name: Get checksums
id: get_checksums
run: |
checksums=$(printf 'SHA-256:\n```\n%s\n```\n' "$(sha256sum *.zip)")
checksums="${checksums//'%'/'%25'}"
checksums="${checksums//$'\n'/'%0A'}"
checksums="${checksums//$'\r'/'%0D'}"
echo "::set-output name=checksums::$checksums"
- name: Create new tag
id: get_tag
run: |
new_tag="bootstrap-$(date "+%Y.%m.%d")"
existing_tag_revision=$(git tag | grep "$new_tag" | sort -r | head -n 1 | cut -d- -f3 | cut -dr -f2)
if [ -n "$existing_tag_revision" ]; then
tag_rev=$((existing_tag_revision + 1))
else
tag_rev=1
fi
new_tag="${new_tag}-r${tag_rev}+apt-android-7"
git tag "$new_tag"
git push --tags
echo "::set-output name=tag_name::$new_tag"
- name: Publish GitHub release
uses: termux/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "*.zip"
file_glob: true
release_name: "Bootstrap archives for Termux application"
tag: ${{ steps.get_tag.outputs.tag_name }}
body: ${{ steps.get_checksums.outputs.checksums }}