mirror of
https://github.com/built-aur/packages
synced 2024-08-14 23:01:15 +00:00
134 lines
3.2 KiB
YAML
134 lines
3.2 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'packages/**'
|
|
|
|
pull_request:
|
|
paths:
|
|
- 'packages/**'
|
|
|
|
workflow_dispatch:
|
|
inputs:
|
|
packages:
|
|
description: "A space-separated names of packages selected for rebuilding"
|
|
required: true
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
arch: [x86-64, x86-64-v3]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1000
|
|
|
|
- name: Prepare Build
|
|
run: |
|
|
./scripts/prepare-build.sh
|
|
env:
|
|
github_event: ${{ github.event_name }}
|
|
github_inputs_packages: ${{ github.event.inputs.packages }}
|
|
|
|
- name: Disk size before build
|
|
run: df -h
|
|
|
|
- name: Build
|
|
if: always()
|
|
run: |
|
|
if [ -f ./built_packages.txt ]
|
|
then
|
|
./scripts/run-docker.sh
|
|
fi
|
|
env:
|
|
github_event: ${{ github.event_name }}
|
|
github_inputs_packages: ${{ github.event.inputs.packages }}
|
|
BUILD_ARCH: ${{ matrix.arch }}
|
|
|
|
- name: Disk size after build
|
|
if: always()
|
|
run: df -h
|
|
|
|
- name: Packages
|
|
if: always()
|
|
run: |
|
|
if [ -f ./built_packages.txt ]
|
|
then
|
|
printf "\n\nPackages Size:\n"
|
|
xz -l ./pkgs/*.xz
|
|
fi
|
|
|
|
- name: Update file names
|
|
if: always() && github.event_name != 'pull_request'
|
|
run: |
|
|
cd pkgs
|
|
|
|
sudo chown -R $(whoami) .
|
|
|
|
for file in *.pkg.tar*
|
|
do
|
|
new_filename="${file//:/_}"
|
|
|
|
if [ "$file" != "$new_filename" ]
|
|
then
|
|
mv "$file" "$new_filename"
|
|
fi
|
|
done
|
|
|
|
- name: Upload artifact
|
|
if: always()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: packages-${{ matrix.arch }}
|
|
path: ./pkgs
|
|
|
|
upload:
|
|
if: github.event_name != 'pull_request' && always()
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1000
|
|
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: ./
|
|
|
|
- name: Import GPG key
|
|
if: always() && github.event_name != 'pull_request'
|
|
uses: crazy-max/ghaction-import-gpg@v4
|
|
with:
|
|
gpg_private_key: ${{ secrets.GPG_SECRET }}
|
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
|
|
|
- name: Sign packages
|
|
if: always() && github.event_name != 'pull_request'
|
|
env:
|
|
gpg_key: ${{ secrets.GPG_KEY }}
|
|
run: |
|
|
for file in ./packages-*/*.pkg.tar*
|
|
do
|
|
gpg --detach-sign --use-agent --default-key "${gpg_key}" --batch --yes "${file}"
|
|
done
|
|
|
|
- name: Upload packages
|
|
if: always() && github.event_name != 'pull_request'
|
|
env:
|
|
SFTP_HOST: ${{ secrets.SFTP_HOST }}
|
|
SFTP_USER: ${{ secrets.SFTP_USER }}
|
|
SFTP_PASSWORD: ${{ secrets.SFTP_PASSWORD }}
|
|
SFTP_CWD: ${{ secrets.SFTP_CWD }}
|
|
run: ./scripts/upload.sh
|