-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a2279bb
Showing
8 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM archlinux/base | ||
|
||
RUN pacman -Sy && \ | ||
pacman -Sy --noconfirm --needed openssh sudo \ | ||
git fakeroot binutils gcc awk binutils xz \ | ||
libarchive bzip2 coreutils file findutils \ | ||
gettext grep gzip sed ncurses util-linux | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
COPY build.sh /build.sh | ||
COPY ssh_config /ssh_config | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# The MIT License | ||
|
||
Copyright (c) 2020 Hoàng Văn Khải | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Publish AUR packages | ||
|
||
GitHub Actions to publish AUR package. | ||
|
||
## Inputs | ||
|
||
### `pkgname` | ||
|
||
**Required** AUR package name. | ||
|
||
### `pkgbuild` | ||
|
||
**Required** Path to PKGBUILD file. | ||
|
||
### `commit_username` | ||
|
||
**Required** The username to use when creating the new commit. | ||
|
||
### `commit_email` | ||
|
||
**Required** The email to use when creating the new commit. | ||
|
||
### `ssh_private_key` | ||
|
||
**Required** Your private key with access to AUR package. | ||
|
||
### `commit_message` | ||
|
||
**Optional** Commit message to use when creating the new commit. | ||
|
||
### `ssh_keyscan_types` | ||
|
||
**Optional** Comma-separated list of types to use when adding aur.archlinux.org to known hosts. | ||
|
||
## Example usage | ||
|
||
```yaml | ||
name: aur-publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
aur-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Publish AUR package | ||
uses: KSXGitHub/github-actions-deploy-aur@master | ||
with: | ||
pkgname: my-awesome-package | ||
pkgbuild: ./PKGBUILD | ||
commit_username: ${{ secrets.AUR_USERNAME }} | ||
commit_email: ${{ secrets.AUR_EMAIL }} | ||
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | ||
commit_message: Update AUR package | ||
ssh_keyscan_types: rsa,dsa,ecdsa,ed25519 | ||
``` | ||
**Tip:** To create secrets (such as `secrets.AUR_USERNAME`, `secrets.AUR_EMAIL`, and `secrets.AUR_SSH_PRIVATE_KEY` above), go to `$YOUR_GITHUB_REPO_URL/settings/secrets`. [Read this for more information](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets). |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# action.yml | ||
name: 'Publish AUR package' | ||
description: 'Publish an AUR package' | ||
author: KSXGitHub | ||
branding: | ||
color: blue | ||
icon: package | ||
inputs: | ||
pkgname: | ||
description: 'AUR package name' | ||
required: true | ||
pkgbuild: | ||
description: 'Path to PKGBUILD file' | ||
required: true | ||
commit_username: | ||
description: 'The username to use when creating the new commit' | ||
required: true | ||
commit_email: | ||
description: 'The email to use when creating the new commit' | ||
required: true | ||
ssh_private_key: | ||
description: 'Your private key with access to AUR package.' | ||
required: true | ||
commit_message: | ||
description: 'Commit message to use when creating the new commit' | ||
required: false | ||
default: 'Update PKGBUILD and .SRCINFO with GitHub Actions' | ||
ssh_keyscan_types: | ||
description: 'Comma-separated list of types to use when adding aur.archlinux.org to known hosts' | ||
required: false | ||
default: 'rsa,dsa,ecdsa,ed25519' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
# shellcheck disable=SC2024 | ||
|
||
set -o errexit -o pipefail -o nounset | ||
|
||
pkgname=$INPUT_PKGNAME | ||
commit_username=$INPUT_COMMIT_USERNAME | ||
commit_email=$INPUT_COMMIT_EMAIL | ||
ssh_private_key=$INPUT_SSH_PRIVATE_KEY | ||
commit_message=$INPUT_COMMIT_MESSAGE | ||
ssh_keyscan_types=$INPUT_SSH_KEYSCAN_TYPES | ||
|
||
export HOME=/home/builder | ||
|
||
echo 'Adding aur.archlinux.org to known hosts...' | ||
ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts | ||
|
||
echo 'Importing private key...' | ||
echo "$ssh_private_key" > ~/.ssh/aur | ||
chmod -vR 600 ~/.ssh/aur* | ||
ssh-keygen -vy -f ~/.ssh/aur > ~/.ssh/aur.pub | ||
|
||
echo 'Checksums of SSH keys...' | ||
sha512sum ~/.ssh/aur ~/.ssh/aur.pub | ||
|
||
echo 'Configuring git...' | ||
git config --global user.name "$commit_username" | ||
git config --global user.email "$commit_email" | ||
|
||
echo 'Cloning AUR package into /tmp/local-repo...' | ||
git clone -v "https://aur.archlinux.org/${pkgname}.git" /tmp/local-repo | ||
cd /tmp/local-repo | ||
|
||
echo 'Copying PKGBUILD...' | ||
cp -v /PKGBUILD ./ | ||
|
||
echo "Updating .SRCINFO" | ||
makepkg --printsrcinfo > .SRCINFO | ||
|
||
echo "Publishing..." | ||
git remote add aur "ssh://[email protected]/${pkgname}.git" | ||
git add -fv PKGBUILD .SRCINFO | ||
git commit --allow-empty -m "$commit_message" | ||
git push -fv aur master |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit -o pipefail -o nounset | ||
|
||
pkgbuild=$INPUT_PKGBUILD | ||
|
||
echo 'Creating builder user...' | ||
useradd --create-home --shell /bin/bash builder | ||
passwd --delete builder | ||
|
||
echo 'Initializing ssh directory...' | ||
mkdir -pv /home/builder/.ssh | ||
touch /home/builder/.ssh/known_hosts | ||
cp -v /ssh_config /home/builder/.ssh/config | ||
chown -vR builder:builder /home/builder | ||
chmod -vR 600 /home/builder/.ssh/* | ||
|
||
echo 'Copying PKGBUILD...' | ||
cp -r "$pkgbuild" /PKGBUILD | ||
|
||
echo 'Running build.sh...' | ||
exec runuser builder --command 'bash -l -c /build.sh' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": [ | ||
"config:base" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Host aur.archlinux.org | ||
IdentityFile ~/.ssh/aur | ||
User aur |