├── action.yml ├── entrypoint.sh ├── .github └── workflows │ └── build-docker.yml ├── LICENSE ├── Dockerfile └── README.md /action.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Build Archlinux package" 3 | description: "Build Archlinux package" 4 | branding: 5 | icon: package 6 | color: blue 7 | inputs: 8 | repos: 9 | description: > 10 | A list of custom repositories. 11 | required: false 12 | before: 13 | description: > 14 | scripts before install packages. 15 | required: false 16 | packages: 17 | description: > 18 | A string with a space separated list of aur packages that should 19 | be built and included in the repository. 20 | required: true 21 | scripts: 22 | required: true 23 | runs: 24 | using: docker 25 | image: docker://countstarlight/makepkg:latest 26 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh -l 2 | 3 | if [ -d "/github" ]; then 4 | sudo chown -R build /github/workspace /github/home 5 | fi 6 | 7 | # add custom repositories to pacman.conf 8 | for r in $INPUT_REPOS; do 9 | IFS=" " read -r -a splitarr <<< "${r//=/ }" 10 | echo -e "\n[${splitarr[0]}]" | sudo tee -a /etc/pacman.conf 11 | echo "Server = ${splitarr[1]}" | sudo tee -a /etc/pacman.conf 12 | done 13 | 14 | # update repos 15 | sudo pacman -Syy 16 | 17 | if [ ! -z "$INPUT_BEFORE" ]; then 18 | eval $INPUT_BEFORE || exit $? 19 | fi 20 | 21 | sudo pacman -Syu --noconfirm 22 | 23 | for pkg in $INPUT_PACKAGES; do 24 | yay -S "$pkg" --noconfirm --needed --useask --gpgflags "--keyserver hkp://pool.sks-keyservers.net" || exit $? 25 | done 26 | 27 | eval $INPUT_SCRIPTS || exit $? 28 | -------------------------------------------------------------------------------- /.github/workflows/build-docker.yml: -------------------------------------------------------------------------------- 1 | name: Build docker 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * *' 6 | push: 7 | branches: master 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | env: 13 | IMAGE: docker.pkg.github.com/countstarlight/arch-makepkg-action/makepkg 14 | DOCKERHUB_IMAGE: countstarlight/makepkg 15 | steps: 16 | - name: Checkout repository 17 | uses: actions/checkout@v1 18 | - name: Login docker registry 19 | env: 20 | DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} 21 | run: | 22 | docker login -u countstarlight -p $DOCKER_TOKEN 23 | - name: Build docker image 24 | run: docker build --rm=true -t $DOCKERHUB_IMAGE:latest . 25 | - name: Push docker image 26 | run: | 27 | docker push $DOCKERHUB_IMAGE:latest 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Mijail Rondon and contributors 4 | Copyright (c) 2021 Codist and contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIE OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE.S 23 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM archlinux/archlinux:base-devel 2 | MAINTAINER Vufa 3 | 4 | ENV UGID='2000' UGNAME='build' 5 | 6 | # Add sudoers 7 | RUN echo "build ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$UGNAME 8 | 9 | RUN chmod 'u=r,g=r,o=' /etc/sudoers.d/$UGNAME 10 | 11 | RUN \ 12 | # Update 13 | pacman-key --init && \ 14 | pacman-key --populate archlinux && \ 15 | pacman -Syu \ 16 | base-devel \ 17 | git \ 18 | reflector \ 19 | rsync \ 20 | --noconfirm --need && \ 21 | # Clean .pacnew files 22 | find / -name "*.pacnew" -exec rename .pacnew '' '{}' \; 23 | 24 | # Setup build user/group 25 | RUN \ 26 | groupadd --gid "$UGID" "$UGNAME" && \ 27 | useradd --create-home --uid "$UGID" --gid "$UGID" --shell /usr/bin/false "${UGNAME}" 28 | 29 | USER $UGNAME 30 | 31 | RUN \ 32 | sudo reflector --verbose -l 10 \ 33 | --sort rate --save /etc/pacman.d/mirrorlist 34 | 35 | ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/core_perl 36 | 37 | # install yay 38 | RUN \ 39 | cd /home/$UGNAME && \ 40 | curl -O -s https://aur.archlinux.org/cgit/aur.git/snapshot/yay-bin.tar.gz && \ 41 | tar xf yay-bin.tar.gz && \ 42 | cd yay-bin && makepkg -is --skippgpcheck --noconfirm && cd .. && \ 43 | rm -rf yay-bin && rm yay-bin.tar.gz 44 | 45 | # Enable multilib repo 46 | RUN sudo sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf 47 | 48 | COPY entrypoint.sh /entrypoint.sh 49 | 50 | ENTRYPOINT ["/entrypoint.sh"] 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # arch-makepkg-action 2 | 3 |

4 | 5 | Build Status 6 | 7 | 8 | Docker pulls 9 | 10 | 11 | License 12 | 13 |

14 | 15 | This create a package using the PKGBUILD on the root of the repository 16 | 17 | ## Usage 18 | 19 | ```yaml 20 | steps: 21 | - name: Build archlinux package 22 | uses: vufa/arch-makepkg-action@master 23 | with: 24 | repos: > 25 | exampleRepo=http://example.org/repos/$repo/$arch 26 | before: "echo hello" 27 | packages: > 28 | p7zip 29 | wine 30 | scripts: "makepkg" 31 | ``` 32 | 33 | Then you can upload the artifact with your package name and version specified 34 | on the PKGBUILD 35 | 36 | ## Real-world applications 37 | 38 | * [deepin-wine-tim-arch](https://github.com/vufa/deepin-wine-tim-arch/actions) | [ci.yml](https://github.com/vufa/deepin-wine-tim-arch/blob/action/.github/workflows/ci.yml) | ![Build Status](https://img.shields.io/github/actions/workflow/status/vufa/deepin-wine-tim-arch/ci.yml?logo=github&style=flat-square) 39 | 40 | * [deepin-wine-wechat-arch](https://github.com/vufa/deepin-wine-wechat-arch/actions) | [ci.yml](https://github.com/vufa/deepin-wine-wechat-arch/blob/action/.github/workflows/ci.yml) | ![Build Status](https://img.shields.io/github/actions/workflow/status/vufa/deepin-wine-wechat-arch/ci.yml?logo=github&style=flat-square) 41 | 42 | * [deepin-wine-qq-arch](https://github.com/vufa/deepin-wine-qq-arch/actions) | [ci.yml](https://github.com/vufa/deepin-wine-qq-arch/blob/action/.github/workflows/ci.yml) | ![Build Status](https://img.shields.io/github/actions/workflow/status/vufa/deepin-wine-qq-arch/ci.yml?logo=github&style=flat-square) 43 | 44 | ## License 45 | The scripts and documentation in this project are released under the [MIT License](LICENSE) 46 | --------------------------------------------------------------------------------