cgct/cgt: bump to 14.2.1 (#310) #47
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 cgct | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'cgct/**' | |
pull_request: | |
paths: | |
- 'cgct/**' | |
workflow_dispatch: | |
inputs: | |
packages: | |
description: "A space-separated names of packages selected for rebuilding" | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Get list cgct packages | |
run: | | |
mkdir -p "pkgs/PKGBUILDs" | |
if [ ${{ github.event_name }} != "workflow_dispatch" ]; then | |
if [ ${{ github.event_name }} = "pull_request" ]; then | |
list=$(curl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s -X GET -G \ | |
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | jq -r '.[] | .filename') | |
else | |
list=$(curl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s -X GET -G \ | |
"https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }}" | jq -r ".files[].filename") | |
fi | |
for i in $list; do | |
il=(${i//// }) | |
if [ "${il[0]}" = "cgct" ]; then | |
if [ -d "${il[0]}/${il[1]}" ]; then | |
if [ ! -f pkgs/cgct-need.txt ] || ! $(grep -q "^${il[1]}$" pkgs/cgct-need.txt); then | |
echo "${il[1]}" >> pkgs/cgct-need.txt | |
curl -L "https://raw.githubusercontent.com/termux-pacman/glibc-packages/$(git log -n 2 --format=format:%H cgct/${il[1]} | tail -1)/cgct/${il[1]}/PKGBUILD" -o pkgs/PKGBUILDs/${il[1]} | |
fi | |
else | |
echo "${il[1]}" >> pkgs/deleted_cgct_packages.txt | |
fi | |
fi | |
done | |
else | |
for i in ${{ github.event.inputs.packages }}; do | |
if [ ! -d cgct/${i} ]; then | |
echo "Error: package '${i}' not found" | |
exit 1 | |
fi | |
if [ ! -f pkgs/cgct-need.txt ] || ! $(grep -q "^${i}$" pkgs/cgct-need.txt); then | |
echo "${i}" >> pkgs/cgct-need.txt | |
fi | |
done | |
fi | |
- name: Build cgct packages | |
run: | | |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost | |
for i in $(cat "pkgs/cgct-need.txt"); do | |
sudo ./scripts-cgct/docker.sh ./scripts-cgct/build.sh ${i} | |
done | |
tar cJf cgct-${{ github.sha }}.tar.xz pkgs | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cgct-${{ github.sha }} | |
path: "./cgct-${{ github.sha }}.tar.xz" | |
if-no-files-found: error | |
upload: | |
if: github.event_name != 'pull_request' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Get packages | |
uses: actions/[email protected] | |
with: | |
path: ./ | |
- name: Install aws-cli | |
run: | | |
git clone https://github.com/termux-pacman/aws-cli-action.git | |
./aws-cli-action/setup.sh '${{ secrets.AWS_ACCESS_KEY_ID }}' '${{ secrets.AWS_ACCESS_KEY }}' '${{ secrets.AWS_REGION }}' | |
- name: Import GPG key | |
run: | | |
echo '${{ secrets.SF_GPG_BOT }}' > key.gpg | |
gpg --pinentry-mode=loopback --passphrase '${{ secrets.PW_GPG_BOT }}' --import key.gpg > /dev/null | |
rm key.gpg | |
- name: Uploading packages to aws | |
run: | | |
sfuf() { | |
gpg --batch --pinentry-mode=loopback --passphrase '${{ secrets.PW_GPG_BOT }}' --detach-sign --use-agent -u '${{ secrets.KEY_GPG_BOT }}' --no-armor "$1" | |
for format_file in "" ".sig"; do | |
aws s3 cp "${1}${format_file}" s3://'${{ secrets.SFPU }}'/cgct/x86_64/"${1##*/}${format_file}" | |
done | |
} | |
tar xJf cgct-${{ github.sha }}/cgct-${{ github.sha }}.tar.xz | |
dp_file="deleted_cgct_packages.txt" | |
if [[ -f pkgs/$dp_file ]]; then | |
path_dp_file=pkgs/${{ github.sha }}_${dp_file} | |
mv pkgs/${dp_file} ${path_dp_file} | |
sfuf "${path_dp_file}" | |
fi | |
for pkg in $(ls pkgs/*.pkg.* 2> /dev/null); do | |
sfuf "$pkg" | |
done | |
rm -fr pkgs |