build repository #728
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 repository | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux:base-devel | |
env: | |
BUILDDIR: /tmp/makepkg | |
CCACHE_DIR: /tmp/ccache | |
GOCACHE: /tmp/gocache | |
GOPATH: /tmp/gopath | |
PACKAGER: ${{ secrets.PACKAGER }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: install dependencies | |
run: | | |
cat pacman.conf >> /etc/pacman.conf | |
pacman -Syuq --needed --noconfirm asp ccache git namcap | |
- name: setup makepkg | |
run: | | |
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV | |
echo "PKGDEST=$PWD/pkgs" >> $GITHUB_ENV | |
useradd -M builduser | |
echo 'builduser ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/builduser | |
sed -i -e 's/!ccache/ccache/' /etc/makepkg.conf | |
cat makepkg.conf >> /etc/makepkg.conf | |
- uses: actions/cache@v1 | |
if: ${{ !env.ACT }} | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ccache-${{ github.sha }} | |
restore-keys: | | |
ccache- | |
- run: sudo -EHu builduser ccache -z | |
- name: generate dynamic packages | |
run: | | |
while read pkg; do | |
curl -sSL "https://aur.archlinux.org/cgit/aur.git/snapshot/$pkg.tar.gz" | tar zxvf - | |
done < aur_packages.txt | |
- name: build packages | |
run: | | |
chown -R builduser . | |
find -name PKGBUILD -execdir sh -c 'yes | sudo -EHu builduser makepkg -crs --noconfirm' \; | |
- name: create repo db | |
run: repo-add ${{ env.PKGDEST }}/rsa.db.tar.zst ${{ env.PKGDEST }}/*.pkg.tar.zst | |
- run: sudo -EHu builduser ccache --show-stats | |
- run: cp -LR ${{ env.PKGDEST }} output | |
- uses: crazy-max/ghaction-github-pages@v2 | |
if: ${{ github.ref == 'refs/heads/master' }} | |
with: | |
target_branch: gh-pages | |
build_dir: output | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |