submodule: update #178
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |