CI: add script to generate bootstraps

So they don't have to be built manually.
This commit is contained in:
Henrik Grimler 2022-04-28 20:52:36 +02:00
parent 21d6c696f7
commit 8b3f62064c
No known key found for this signature in database
GPG Key ID: B0076E490B71616B
1 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,69 @@
name: Generate bootstrap archives (android-5)
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- aarch64
- arm
- i686
- x86_64
steps:
- name: Git clone
uses: actions/checkout@v3
- name: Create bootstrap archive
run: ./scripts/generate-bootstraps.sh --architectures ${{ matrix.arch }}
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: bootstrap-archives-${{ github.sha }}
path: "*.zip"
publish:
needs: build
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: bootstrap-archives-${{ 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")+apt-android-5"
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}"
git tag "$new_tag"
git push --tags
echo "::set-output name=tag_name::$new_tag"
- name: Publish GitHub release
uses: termux/upload-release-action@v3.0.3
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "*.zip"
file_glob: true
release_name: "Bootstrap archives for Termux application (apt-android-5)"
tag: ${{ steps.get_tag.outputs.tag_name }}
body: ${{ steps.get_checksums.outputs.checksums }}