From 650d2f81f662834529f31d35645e31ba26da8092 Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 17:10:19 +0100 Subject: [PATCH 01/94] first commit --- Dockerfile | 24 ++++++++++++++++++++++++ README.md | 37 +++++++++++++++++++++++++++++++++++++ action.yml | 25 +++++++++++++++++++++++++ entrypoint.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ gitconfig | 4 ++++ ssh_config | 3 +++ 6 files changed, 137 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 action.yml create mode 100755 entrypoint.sh create mode 100644 gitconfig create mode 100644 ssh_config diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..50dee61 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM archlinux/base + +RUN pacman -Sy && \ + pacman -Sy --noconfirm openssh \ + git fakeroot binutils go-pie gcc awk binutils xz \ + libarchive bzip2 coreutils file findutils \ + gettext grep gzip sed ncurses + +RUN useradd -ms /bin/bash builder && \ + mkdir -p /home/builder/.ssh + +COPY ssh_config /home/builder/.ssh/config +COPY gitconfig /home/builder/.gitconfig + +RUN chown builder:builder /home/builder -R && \ + chmod 600 /home/builder/.ssh/* -R + +COPY entrypoint.sh /entrypoint.sh + +USER builder +WORKDIR /home/builder + +ENTRYPOINT ["/entrypoint.sh"] + diff --git a/README.md b/README.md new file mode 100644 index 0000000..557f4b9 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# AUR publish docker action + +This action can publish an AUR package. + +## Inputs + +### `package-name` + +**Required** The AUR package name you want to update. + +### `version` + +**Required** version to publish. + +### `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. + + + +## Example usage + +uses: aur-publish-docker-action@v1 +with: + package-name: my-awesome-package + version: {{ github.ref }} + commit-username: 'Github Action Bot' + commit-email: github-action-bot@example.com + ssh-private-key: {{ secrets.aur-ssh-private-key }} diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..3483308 --- /dev/null +++ b/action.yml @@ -0,0 +1,25 @@ +# action.yml +name: 'AUR publish docker' +description: 'Publish an AUR package' +inputs: + package-name: + description: 'AUR package name' + required: true + version: + description: 'version to publish' + 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 + +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.package-name }} ${{ inputs.version }} ${{ inputs.commit-username }} ${{ inputs.commit-email }} ${{ inputs.ssh-private-key }} diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..c1bdac7 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -o errexit -o pipefail -o nounset + +REPO_NAME=$1 +NEW_RELEASE=$2 +GIT_USERNAME=$3 +GIT_EMAIL=$4 +SSH_PRIVATE_KEY=$5 + +ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts + +echo -e "${SSH_PRIVATE_KEY//_/\\n}" > ~/.ssh/aur + +chmod 600 ~/.ssh/aur* + +sed -i "s/name = .*$/name = $GIT_USERNAME/" ~/.gitconfig +sed -i "s/email = .*$/email = $GIT_EMAIL/" ~/.gitconfig + +REPO_URL="ssh://aur@aur.archlinux.org/${REPO_NAME}.git" + +echo "------------- CLONNING $REPO_URL ----------------" + +git clone $REPO_URL +cd $REPO_NAME + +echo "------------- BUILDING PKG $REPO_NAME ----------------" + +sed -i "s/pkgver=.*$/pkgver=$NEW_RELEASE/" PKGBUILD +sed -i "s/sha256sums=.*$/$(makepkg -g 2>/dev/null)/" PKGBUILD + +# Test build +makepkg -c + +# Update srcinfo +makepkg --printsrcinfo > .SRCINFO + + +echo "------------- BUILD DONE ----------------" + +# Update aur +git add PKGBUILD .SRCINFO +git commit -m "Update to $NEW_RELEASE" + diff --git a/gitconfig b/gitconfig new file mode 100644 index 0000000..110c81a --- /dev/null +++ b/gitconfig @@ -0,0 +1,4 @@ + +[user] + name = Github Action Bot + email = github-action-bot@example.com diff --git a/ssh_config b/ssh_config new file mode 100644 index 0000000..a4c0f45 --- /dev/null +++ b/ssh_config @@ -0,0 +1,3 @@ +Host aur.archlinux.org + IdentityFile ~/.ssh/aur + User aur From fae8a50d11bb17b208e2ed6fd42705e473788352 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Fri, 27 Mar 2020 17:11:36 +0100 Subject: [PATCH 02/94] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 557f4b9..4f533f8 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ This action can publish an AUR package. ## Example usage +``` uses: aur-publish-docker-action@v1 with: package-name: my-awesome-package @@ -35,3 +36,4 @@ with: commit-username: 'Github Action Bot' commit-email: github-action-bot@example.com ssh-private-key: {{ secrets.aur-ssh-private-key }} +``` From f934bc637fe43c1796f22fd3e6f11d3309484e09 Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 17:14:25 +0100 Subject: [PATCH 03/94] add git push --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index c1bdac7..7537bf7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -40,5 +40,5 @@ echo "------------- BUILD DONE ----------------" # Update aur git add PKGBUILD .SRCINFO -git commit -m "Update to $NEW_RELEASE" - +git commit --allow-empty -m "Update to $NEW_RELEASE" +git push From 39861a1a019da7b76295ddfbff9ecc8ba4219b1d Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 17:27:55 +0100 Subject: [PATCH 04/94] change variables --- Dockerfile | 1 - README.md | 33 ++++++++++++++++++--------------- action.yml | 13 +++++-------- entrypoint.sh | 13 +++++++++---- gitconfig | 4 ---- 5 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 gitconfig diff --git a/Dockerfile b/Dockerfile index 50dee61..017639e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,6 @@ RUN useradd -ms /bin/bash builder && \ mkdir -p /home/builder/.ssh COPY ssh_config /home/builder/.ssh/config -COPY gitconfig /home/builder/.gitconfig RUN chown builder:builder /home/builder -R && \ chmod 600 /home/builder/.ssh/* -R diff --git a/README.md b/README.md index 4f533f8..2b62c2f 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,19 @@ This action can publish an AUR package. ## Inputs -### `package-name` +### `package_name` **Required** The AUR package name you want to update. -### `version` - -**Required** version to publish. - -### `commit-username` +### `commit_username` **Required** The username to use when creating the new commit. -### `commit-email` +### `commit_email` **Required** The email to use when creating the new commit. -### `ssh-private-key` +### `ssh_private_key` **Required** Your private key with access to AUR package. @@ -29,11 +25,18 @@ This action can publish an AUR package. ## Example usage ``` -uses: aur-publish-docker-action@v1 -with: - package-name: my-awesome-package - version: {{ github.ref }} - commit-username: 'Github Action Bot' - commit-email: github-action-bot@example.com - ssh-private-key: {{ secrets.aur-ssh-private-key }} +on: + push: + tags: + - '*' + +jobs: + aur_publish: + uses: aur-publish-docker-action@v1 + with: + package_name: my-awesome-package + version: {{ github.ref }} + commit_username: 'Github Action Bot' + commit_email: github-action-bot@example.com + ssh_private_key: {{ secrets.AUR_SSH_PRIVATE_KEY }} ``` diff --git a/action.yml b/action.yml index 3483308..a52c3d4 100644 --- a/action.yml +++ b/action.yml @@ -2,19 +2,16 @@ name: 'AUR publish docker' description: 'Publish an AUR package' inputs: - package-name: + package_name: description: 'AUR package name' required: true - version: - description: 'version to publish' - required: true - commit-username: + commit_username: description: 'The username to use when creating the new commit.' required: true - commit-email: + commit_email: description: 'The email to use when creating the new commit.' required: true - ssh-private-key: + ssh_private_key: description: 'Your private key with access to AUR package.' required: true @@ -22,4 +19,4 @@ runs: using: 'docker' image: 'Dockerfile' args: - - ${{ inputs.package-name }} ${{ inputs.version }} ${{ inputs.commit-username }} ${{ inputs.commit-email }} ${{ inputs.ssh-private-key }} + - ${{ inputs.package_name }} ${{ github.ref }} ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} diff --git a/entrypoint.sh b/entrypoint.sh index 7537bf7..1f1ce88 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,23 +3,26 @@ set -o errexit -o pipefail -o nounset REPO_NAME=$1 -NEW_RELEASE=$2 +NEW_RELEASE=${2##*/v} GIT_USERNAME=$3 GIT_EMAIL=$4 SSH_PRIVATE_KEY=$5 + +echo "---------------- AUR Package version $REPO_NAME/$NEW_RELEASE ----------------" + ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts echo -e "${SSH_PRIVATE_KEY//_/\\n}" > ~/.ssh/aur chmod 600 ~/.ssh/aur* -sed -i "s/name = .*$/name = $GIT_USERNAME/" ~/.gitconfig -sed -i "s/email = .*$/email = $GIT_EMAIL/" ~/.gitconfig +git config --global user.name "$GIT_USERNAME" +git config --global user.email "$GIT_EMAIL" REPO_URL="ssh://aur@aur.archlinux.org/${REPO_NAME}.git" -echo "------------- CLONNING $REPO_URL ----------------" +echo "---------------- $REPO_URL ----------------" git clone $REPO_URL cd $REPO_NAME @@ -42,3 +45,5 @@ echo "------------- BUILD DONE ----------------" git add PKGBUILD .SRCINFO git commit --allow-empty -m "Update to $NEW_RELEASE" git push + +echo "------------- PUBLISH DONE ----------------" diff --git a/gitconfig b/gitconfig deleted file mode 100644 index 110c81a..0000000 --- a/gitconfig +++ /dev/null @@ -1,4 +0,0 @@ - -[user] - name = Github Action Bot - email = github-action-bot@example.com From 9b0b04521a6cdf7116ffe6757d777c44d22fc2e2 Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 17:50:09 +0100 Subject: [PATCH 05/94] add version input --- README.md | 20 ++++++++++++-------- action.yml | 5 ++++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2b62c2f..76cf097 100644 --- a/README.md +++ b/README.md @@ -25,18 +25,22 @@ This action can publish an AUR package. ## Example usage ``` +name: aur-publish on: push: tags: - '*' jobs: - aur_publish: - uses: aur-publish-docker-action@v1 - with: - package_name: my-awesome-package - version: {{ github.ref }} - commit_username: 'Github Action Bot' - commit_email: github-action-bot@example.com - ssh_private_key: {{ secrets.AUR_SSH_PRIVATE_KEY }} + aur-publish: + runs-on: ubuntu-latest + steps: + - name: Publish AUR package + uses: guumaster/aur-publish-docker-action@v1 + with: + package_name: my-awesome-package + version: ${{ github.ref }} + commit_username: 'Github Action Bot' + commit_email: github-action-bot@example.com + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} ``` diff --git a/action.yml b/action.yml index a52c3d4..be86845 100644 --- a/action.yml +++ b/action.yml @@ -5,6 +5,9 @@ inputs: package_name: description: 'AUR package name' required: true + version: + description: 'version to publish' + required: true commit_username: description: 'The username to use when creating the new commit.' required: true @@ -19,4 +22,4 @@ runs: using: 'docker' image: 'Dockerfile' args: - - ${{ inputs.package_name }} ${{ github.ref }} ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} + - ${{ inputs.package_name }} ${{ inputs.version }} ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} From fd054e3834a254ac26104660504dc304488426fb Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 17:54:35 +0100 Subject: [PATCH 06/94] change input to variable GITHUB_REF --- README.md | 1 - action.yml | 5 +---- entrypoint.sh | 8 ++++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 76cf097..50f315f 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,6 @@ jobs: uses: guumaster/aur-publish-docker-action@v1 with: package_name: my-awesome-package - version: ${{ github.ref }} commit_username: 'Github Action Bot' commit_email: github-action-bot@example.com ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} diff --git a/action.yml b/action.yml index be86845..151b26f 100644 --- a/action.yml +++ b/action.yml @@ -5,9 +5,6 @@ inputs: package_name: description: 'AUR package name' required: true - version: - description: 'version to publish' - required: true commit_username: description: 'The username to use when creating the new commit.' required: true @@ -22,4 +19,4 @@ runs: using: 'docker' image: 'Dockerfile' args: - - ${{ inputs.package_name }} ${{ inputs.version }} ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} + - ${{ inputs.package_name }} ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} diff --git a/entrypoint.sh b/entrypoint.sh index 1f1ce88..09d710d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,10 +3,10 @@ set -o errexit -o pipefail -o nounset REPO_NAME=$1 -NEW_RELEASE=${2##*/v} -GIT_USERNAME=$3 -GIT_EMAIL=$4 -SSH_PRIVATE_KEY=$5 +NEW_RELEASE=${GITHUB_REF##*/v} +GIT_USERNAME=$2 +GIT_EMAIL=$3 +SSH_PRIVATE_KEY=$4 echo "---------------- AUR Package version $REPO_NAME/$NEW_RELEASE ----------------" From e2b3e76e8511cd9e9e19598f8b0dba0abba4a2be Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 17:58:01 +0100 Subject: [PATCH 07/94] change input to variable GITHUB_REF --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 151b26f..80e64a9 100644 --- a/action.yml +++ b/action.yml @@ -19,4 +19,4 @@ runs: using: 'docker' image: 'Dockerfile' args: - - ${{ inputs.package_name }} ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} + - ${{ inputs.package_name }} $GITHUB_REF ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} From d46861f83e1104d39c3f00a43987de5d9ecf5caf Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 18:07:30 +0100 Subject: [PATCH 08/94] show vars --- action.yml | 2 +- entrypoint.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 80e64a9..0065c29 100644 --- a/action.yml +++ b/action.yml @@ -19,4 +19,4 @@ runs: using: 'docker' image: 'Dockerfile' args: - - ${{ inputs.package_name }} $GITHUB_REF ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} + - "${{ inputs.package_name }}" "${{ inputs.commit_username }}" "${{ inputs.commit_email }}" "${{ inputs.ssh_private_key }}" diff --git a/entrypoint.sh b/entrypoint.sh index 09d710d..775ff21 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,6 +2,12 @@ set -o errexit -o pipefail -o nounset +echo "---------------- ENV ----------------" +env +echo "---------------- VARS ----------------" +echo "VARS: >>>> $* <<<<" + + REPO_NAME=$1 NEW_RELEASE=${GITHUB_REF##*/v} GIT_USERNAME=$2 From bb9a990b26a849df9c32a9ea3a721f4d3558f08a Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 18:10:28 +0100 Subject: [PATCH 09/94] add vars info --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 775ff21..7bed543 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,7 +5,7 @@ set -o errexit -o pipefail -o nounset echo "---------------- ENV ----------------" env echo "---------------- VARS ----------------" -echo "VARS: >>>> $* <<<<" +echo "VARS: >>>> $1 $2 $3 ${4##*END OPEN} <<<<" REPO_NAME=$1 From 2d7ea9a7e719576be43ace1a650b021efeb94eb4 Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 18:11:53 +0100 Subject: [PATCH 10/94] add vars info --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 0065c29..151b26f 100644 --- a/action.yml +++ b/action.yml @@ -19,4 +19,4 @@ runs: using: 'docker' image: 'Dockerfile' args: - - "${{ inputs.package_name }}" "${{ inputs.commit_username }}" "${{ inputs.commit_email }}" "${{ inputs.ssh_private_key }}" + - ${{ inputs.package_name }} ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} From 9bf16d1395c8fd8669dcbfec190b55dd7e42cc58 Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 18:15:10 +0100 Subject: [PATCH 11/94] clean headers --- entrypoint.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7bed543..09d710d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,12 +2,6 @@ set -o errexit -o pipefail -o nounset -echo "---------------- ENV ----------------" -env -echo "---------------- VARS ----------------" -echo "VARS: >>>> $1 $2 $3 ${4##*END OPEN} <<<<" - - REPO_NAME=$1 NEW_RELEASE=${GITHUB_REF##*/v} GIT_USERNAME=$2 From 2fd0e71af2a923ccbf44b45b2915f86ae99ca88c Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 18:20:32 +0100 Subject: [PATCH 12/94] rename variables and capture from input --- entrypoint.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 09d710d..b3ab187 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,14 +2,15 @@ set -o errexit -o pipefail -o nounset -REPO_NAME=$1 +PACKAGE_NAME=$INPUT_PACKAGE_NAME +COMMIT_USERNAME=$INPUT_COMMIT_USERNAME +COMMIT_EMAIL=$INPUT_COMMIT_EMAIL +SSH_PRIVATE_KEY=$INPUT_SSH_PRIVATE_KEY + NEW_RELEASE=${GITHUB_REF##*/v} -GIT_USERNAME=$2 -GIT_EMAIL=$3 -SSH_PRIVATE_KEY=$4 -echo "---------------- AUR Package version $REPO_NAME/$NEW_RELEASE ----------------" +echo "---------------- AUR Package version $PACKAGE_NAME/$NEW_RELEASE ----------------" ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts @@ -17,17 +18,17 @@ echo -e "${SSH_PRIVATE_KEY//_/\\n}" > ~/.ssh/aur chmod 600 ~/.ssh/aur* -git config --global user.name "$GIT_USERNAME" -git config --global user.email "$GIT_EMAIL" +git config --global user.name "$COMMIT_USERNAME" +git config --global user.email "$COMMIT_EMAIL" -REPO_URL="ssh://aur@aur.archlinux.org/${REPO_NAME}.git" +REPO_URL="ssh://aur@aur.archlinux.org/${PACKAGE_NAME}.git" echo "---------------- $REPO_URL ----------------" -git clone $REPO_URL -cd $REPO_NAME +git clone "$REPO_URL" +cd "$PACKAGE_NAME" -echo "------------- BUILDING PKG $REPO_NAME ----------------" +echo "------------- BUILDING PKG $PACKAGE_NAME ----------------" sed -i "s/pkgver=.*$/pkgver=$NEW_RELEASE/" PKGBUILD sed -i "s/sha256sums=.*$/$(makepkg -g 2>/dev/null)/" PKGBUILD From 44f0831b2ad27ebe29d71e2f29645fa42b1a757d Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 18:24:28 +0100 Subject: [PATCH 13/94] add known_hosts file to Dockerfile --- Dockerfile | 3 ++- entrypoint.sh | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 017639e..49067f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,8 @@ RUN pacman -Sy && \ gettext grep gzip sed ncurses RUN useradd -ms /bin/bash builder && \ - mkdir -p /home/builder/.ssh + mkdir -p /home/builder/.ssh && \ + touch /home/builder/.ssh/known_hosts COPY ssh_config /home/builder/.ssh/config diff --git a/entrypoint.sh b/entrypoint.sh index b3ab187..69e73e9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,7 +9,6 @@ SSH_PRIVATE_KEY=$INPUT_SSH_PRIVATE_KEY NEW_RELEASE=${GITHUB_REF##*/v} - echo "---------------- AUR Package version $PACKAGE_NAME/$NEW_RELEASE ----------------" ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts From 42249e230173e64431d754956e716d6a84bff1d0 Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 18:30:25 +0100 Subject: [PATCH 14/94] add known_hosts --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 69e73e9..2f07bdf 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,6 +11,8 @@ NEW_RELEASE=${GITHUB_REF##*/v} echo "---------------- AUR Package version $PACKAGE_NAME/$NEW_RELEASE ----------------" +touch ~/.ssh/known_hosts + ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts echo -e "${SSH_PRIVATE_KEY//_/\\n}" > ~/.ssh/aur From ac8c83212a5dd1a7ad2a7eac3a3752bc7aef9463 Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 18:35:25 +0100 Subject: [PATCH 15/94] change $HOME --- entrypoint.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2f07bdf..2e60f46 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,15 +9,15 @@ SSH_PRIVATE_KEY=$INPUT_SSH_PRIVATE_KEY NEW_RELEASE=${GITHUB_REF##*/v} -echo "---------------- AUR Package version $PACKAGE_NAME/$NEW_RELEASE ----------------" +export HOME=/home/builder -touch ~/.ssh/known_hosts +echo "---------------- AUR Package version $PACKAGE_NAME/$NEW_RELEASE ----------------" -ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts +ssh-keyscan -t ed25519 aur.archlinux.org >> $HOME/.ssh/known_hosts -echo -e "${SSH_PRIVATE_KEY//_/\\n}" > ~/.ssh/aur +echo -e "${SSH_PRIVATE_KEY//_/\\n}" > $HOME/.ssh/aur -chmod 600 ~/.ssh/aur* +chmod 600 $HOME/.ssh/aur* git config --global user.name "$COMMIT_USERNAME" git config --global user.email "$COMMIT_EMAIL" From 0c025b5459d45c5e41d657fe77efb4f5be0d1539 Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 18:38:42 +0100 Subject: [PATCH 16/94] change clone dir to /tmp --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 2e60f46..a12dd0d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -26,6 +26,7 @@ REPO_URL="ssh://aur@aur.archlinux.org/${PACKAGE_NAME}.git" echo "---------------- $REPO_URL ----------------" +cd /tmp git clone "$REPO_URL" cd "$PACKAGE_NAME" From 23abb174bd23a6ccd220faabd9e54257e69f4e1c Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 19:12:18 +0100 Subject: [PATCH 17/94] update docs --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 50f315f..c7f92ac 100644 --- a/README.md +++ b/README.md @@ -2,30 +2,37 @@ This action can publish an AUR package. + +## Requirements + +It depends on an environment variable called `GITHUB_REF` to be present and it should also contain a semantic version +in the format `v0.0.0` to work properly. + +This tag should also comply with rules established to publish versions on AUR repository. + +You should add to your secrets an SSH private key that match your key uploaded to your AUR account, +so this action can commit and push to it. + + ## Inputs ### `package_name` - **Required** The AUR package name you want to update. ### `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. - ## Example usage - ``` name: aur-publish + on: push: tags: From bef02abde5cfb46e726454e46ee60876f5bc3039 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Fri, 27 Mar 2020 20:11:55 +0100 Subject: [PATCH 18/94] Update action.yml --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index 151b26f..c5b96be 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,10 @@ # action.yml name: 'AUR publish docker' description: 'Publish an AUR package' +author: guumaster +branding: + color: green + icon: upload inputs: package_name: description: 'AUR package name' From eeb7e7c9232655734a34d773d65ca88f52ffd71e Mon Sep 17 00:00:00 2001 From: Gustavo Date: Sat, 28 Mar 2020 09:54:15 +0100 Subject: [PATCH 19/94] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d059033 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [2020] [Gustavo Marin] + +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. From 581c2cd0485bff19a7e506d8ef05f44bd8549eab Mon Sep 17 00:00:00 2001 From: khai96_ Date: Mon, 4 May 2020 19:01:26 +0700 Subject: [PATCH 20/94] Modify --- LICENSE => LICENSE.md | 4 ++-- README.md | 31 ++++++++++++++++--------------- action.yml | 9 ++++++--- entrypoint.sh | 29 ++++++++++++++--------------- 4 files changed, 38 insertions(+), 35 deletions(-) rename LICENSE => LICENSE.md (94%) diff --git a/LICENSE b/LICENSE.md similarity index 94% rename from LICENSE rename to LICENSE.md index d059033..cbdf9a8 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,6 +1,6 @@ -MIT License +# The MIT License -Copyright (c) [2020] [Gustavo Marin] +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 diff --git a/README.md b/README.md index c7f92ac..b64288b 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,33 @@ -# AUR publish docker action +# Publish AUR packages This action can publish an AUR package. +## Inputs -## Requirements - -It depends on an environment variable called `GITHUB_REF` to be present and it should also contain a semantic version -in the format `v0.0.0` to work properly. - -This tag should also comply with rules established to publish versions on AUR repository. - -You should add to your secrets an SSH private key that match your key uploaded to your AUR account, -so this action can commit and push to it. +### `pkgname` +**Required** The AUR package name you want to update. -## Inputs +### `pkgver` -### `package_name` -**Required** The AUR package name you want to update. +**Required** The AUR package version you want to update. ### `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. ## Example usage -``` + +```yaml name: aur-publish on: @@ -43,10 +40,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Publish AUR package - uses: guumaster/aur-publish-docker-action@v1 + uses: KSXGitHub/github-actions-deploy-aur@master with: package_name: my-awesome-package commit_username: 'Github Action Bot' commit_email: github-action-bot@example.com ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} ``` + +## Thanks + +This repository is a fork of https://github.com/guumaster/aur-publish-docker-action.git diff --git a/action.yml b/action.yml index c5b96be..e227a90 100644 --- a/action.yml +++ b/action.yml @@ -1,14 +1,17 @@ # action.yml name: 'AUR publish docker' description: 'Publish an AUR package' -author: guumaster +author: KSXGitHub branding: color: green icon: upload inputs: - package_name: + pkgname: description: 'AUR package name' required: true + pkgver: + description: 'AUR package version' + required: true commit_username: description: 'The username to use when creating the new commit.' required: true @@ -23,4 +26,4 @@ runs: using: 'docker' image: 'Dockerfile' args: - - ${{ inputs.package_name }} ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} + - ${{ inputs.pkgname }} ${{ inputs.pkgver }} ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} diff --git a/entrypoint.sh b/entrypoint.sh index a12dd0d..4d7ca39 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,51 +2,50 @@ set -o errexit -o pipefail -o nounset -PACKAGE_NAME=$INPUT_PACKAGE_NAME +PKGNAME=$INPUT_PKGNAME +PKGVER=${INPUT_PKGVER} COMMIT_USERNAME=$INPUT_COMMIT_USERNAME COMMIT_EMAIL=$INPUT_COMMIT_EMAIL SSH_PRIVATE_KEY=$INPUT_SSH_PRIVATE_KEY -NEW_RELEASE=${GITHUB_REF##*/v} - export HOME=/home/builder -echo "---------------- AUR Package version $PACKAGE_NAME/$NEW_RELEASE ----------------" +echo "---------------- AUR Package version $PKGNAME/$PKGVER ----------------" ssh-keyscan -t ed25519 aur.archlinux.org >> $HOME/.ssh/known_hosts echo -e "${SSH_PRIVATE_KEY//_/\\n}" > $HOME/.ssh/aur -chmod 600 $HOME/.ssh/aur* +chmod 600 $HOME/.ssh/aur* || exit $? git config --global user.name "$COMMIT_USERNAME" git config --global user.email "$COMMIT_EMAIL" -REPO_URL="ssh://aur@aur.archlinux.org/${PACKAGE_NAME}.git" +REPO_URL="ssh://aur@aur.archlinux.org/${PKGNAME}.git" echo "---------------- $REPO_URL ----------------" cd /tmp -git clone "$REPO_URL" -cd "$PACKAGE_NAME" +git clone "$REPO_URL" || exit $? +cd "$PKGNAME" || exit $? -echo "------------- BUILDING PKG $PACKAGE_NAME ----------------" +echo "------------- BUILDING PKG $PKGNAME ----------------" -sed -i "s/pkgver=.*$/pkgver=$NEW_RELEASE/" PKGBUILD +sed -i "s/pkgver=.*$/pkgver=$PKGVER/" PKGBUILD sed -i "s/sha256sums=.*$/$(makepkg -g 2>/dev/null)/" PKGBUILD # Test build -makepkg -c +makepkg -c || exit $? # Update srcinfo -makepkg --printsrcinfo > .SRCINFO +makepkg --printsrcinfo > .SRCINFO || exit $? echo "------------- BUILD DONE ----------------" # Update aur -git add PKGBUILD .SRCINFO -git commit --allow-empty -m "Update to $NEW_RELEASE" -git push +git add PKGBUILD .SRCINFO || exit $? +git commit --allow-empty -m "Update to $PKGVER" || exit $? +git push --force || exit $? echo "------------- PUBLISH DONE ----------------" From a0b65abf479e1cd4fbc887f11976d1e0a5b408fb Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 4 May 2020 12:01:49 +0000 Subject: [PATCH 21/94] Add renovate.json --- renovate.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 renovate.json diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..f45d8f1 --- /dev/null +++ b/renovate.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "config:base" + ] +} From 9fb0a6a7766f698842d57d46964faa4d9f9d3d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kh=E1=BA=A3i?= Date: Mon, 4 May 2020 19:12:32 +0700 Subject: [PATCH 22/94] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e227a90..e7a4fab 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ # action.yml -name: 'AUR publish docker' +name: 'Publish AUR package' description: 'Publish an AUR package' author: KSXGitHub branding: From 328e47ffbce3fe4f95ee07891d80a1c10c9db7ef Mon Sep 17 00:00:00 2001 From: khai96_ Date: Mon, 4 May 2020 19:26:24 +0700 Subject: [PATCH 23/94] Fix README.md example --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b64288b..c2acfc7 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,8 @@ jobs: - name: Publish AUR package uses: KSXGitHub/github-actions-deploy-aur@master with: - package_name: my-awesome-package + pkgname: my-awesome-package + pkgver: 1.2.3 commit_username: 'Github Action Bot' commit_email: github-action-bot@example.com ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} From 6db3da90a69f6d6e09ff32b121964c6347b43839 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Mon, 4 May 2020 19:30:58 +0700 Subject: [PATCH 24/94] Add requirements --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index c2acfc7..ed76d12 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ This action can publish an AUR package. +## Requirements + +This action only modifies existing AUR package and publish it. Make sure targeted package exists first. + ## Inputs ### `pkgname` From 72f1f7faedb01671b029f5debdcacaf343ebc981 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Mon, 4 May 2020 21:44:43 +0700 Subject: [PATCH 25/94] Add --force flag --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 4d7ca39..0286c20 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -44,7 +44,7 @@ makepkg --printsrcinfo > .SRCINFO || exit $? echo "------------- BUILD DONE ----------------" # Update aur -git add PKGBUILD .SRCINFO || exit $? +git add --force PKGBUILD .SRCINFO || exit $? git commit --allow-empty -m "Update to $PKGVER" || exit $? git push --force || exit $? From 13691d6859017d32db870070e21edfc0518c0efb Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 5 May 2020 16:00:53 +0700 Subject: [PATCH 26/94] Remove runs.args --- action.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/action.yml b/action.yml index e7a4fab..4eec2df 100644 --- a/action.yml +++ b/action.yml @@ -25,5 +25,3 @@ inputs: runs: using: 'docker' image: 'Dockerfile' - args: - - ${{ inputs.pkgname }} ${{ inputs.pkgver }} ${{ inputs.commit_username }} ${{ inputs.commit_email }} ${{ inputs.ssh_private_key }} From 8af51e694d6e9acdb1fa757464f223358853af79 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 5 May 2020 16:05:52 +0700 Subject: [PATCH 27/94] Change branding --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 4eec2df..3fabb8b 100644 --- a/action.yml +++ b/action.yml @@ -3,8 +3,8 @@ name: 'Publish AUR package' description: 'Publish an AUR package' author: KSXGitHub branding: - color: green - icon: upload + color: blue + icon: package inputs: pkgname: description: 'AUR package name' From 69978921a1901d5d2c29a811e19349cdd3e2f0a9 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 5 May 2020 16:22:34 +0700 Subject: [PATCH 28/94] Reformat --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 49067f5..264408c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,4 +21,3 @@ USER builder WORKDIR /home/builder ENTRYPOINT ["/entrypoint.sh"] - From 341cc1ffa9f439d218359a8bef0bafc79e51572b Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 18:35:44 +0700 Subject: [PATCH 29/94] Do not create builder user --- Dockerfile | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 264408c..5da7f27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,18 +6,11 @@ RUN pacman -Sy && \ libarchive bzip2 coreutils file findutils \ gettext grep gzip sed ncurses -RUN useradd -ms /bin/bash builder && \ - mkdir -p /home/builder/.ssh && \ - touch /home/builder/.ssh/known_hosts - -COPY ssh_config /home/builder/.ssh/config - -RUN chown builder:builder /home/builder -R && \ - chmod 600 /home/builder/.ssh/* -R +RUN mkdir -p /root/.ssh +RUN touch /root/.ssh/known_hosts +COPY ssh_config /root/.ssh/config +RUN chmod 600 /root/.ssh/* -R COPY entrypoint.sh /entrypoint.sh -USER builder -WORKDIR /home/builder - ENTRYPOINT ["/entrypoint.sh"] From 89d92cc6391ddf7bd4d8825fe7eb7dc5fbc2887e Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 18:37:24 +0700 Subject: [PATCH 30/94] Add inputs.pkgbuild --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 3fabb8b..049b829 100644 --- a/action.yml +++ b/action.yml @@ -9,8 +9,8 @@ inputs: pkgname: description: 'AUR package name' required: true - pkgver: - description: 'AUR package version' + pkgbuild: + description: 'Path to PKGBUILD file' required: true commit_username: description: 'The username to use when creating the new commit.' From b65a0b764fdcfa8b6db76f6bd00c0609b27044b3 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 18:37:51 +0700 Subject: [PATCH 31/94] Remove an empty line --- action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yml b/action.yml index 049b829..5ffd02d 100644 --- a/action.yml +++ b/action.yml @@ -21,7 +21,6 @@ inputs: ssh_private_key: description: 'Your private key with access to AUR package.' required: true - runs: using: 'docker' image: 'Dockerfile' From 556d38dc588bde80c0b5c1ca3cbc14e5d4ee5880 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 18:43:12 +0700 Subject: [PATCH 32/94] Remove useless "|| exit $?" --- entrypoint.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 0286c20..4560364 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,7 +16,7 @@ ssh-keyscan -t ed25519 aur.archlinux.org >> $HOME/.ssh/known_hosts echo -e "${SSH_PRIVATE_KEY//_/\\n}" > $HOME/.ssh/aur -chmod 600 $HOME/.ssh/aur* || exit $? +chmod 600 $HOME/.ssh/aur* git config --global user.name "$COMMIT_USERNAME" git config --global user.email "$COMMIT_EMAIL" @@ -26,8 +26,8 @@ REPO_URL="ssh://aur@aur.archlinux.org/${PKGNAME}.git" echo "---------------- $REPO_URL ----------------" cd /tmp -git clone "$REPO_URL" || exit $? -cd "$PKGNAME" || exit $? +git clone "$REPO_URL" +cd "$PKGNAME" echo "------------- BUILDING PKG $PKGNAME ----------------" @@ -35,17 +35,17 @@ sed -i "s/pkgver=.*$/pkgver=$PKGVER/" PKGBUILD sed -i "s/sha256sums=.*$/$(makepkg -g 2>/dev/null)/" PKGBUILD # Test build -makepkg -c || exit $? +makepkg -c # Update srcinfo -makepkg --printsrcinfo > .SRCINFO || exit $? +makepkg --printsrcinfo > .SRCINFO echo "------------- BUILD DONE ----------------" # Update aur -git add --force PKGBUILD .SRCINFO || exit $? -git commit --allow-empty -m "Update to $PKGVER" || exit $? -git push --force || exit $? +git add --force PKGBUILD .SRCINFO +git commit --allow-empty -m "Update to $PKGVER" +git push --force echo "------------- PUBLISH DONE ----------------" From c0ebbf5716b757f90adf4e1f3abc8c71d34f935a Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 18:47:32 +0700 Subject: [PATCH 33/94] Set HOME to /root --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 4560364..f51d1f0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,7 +8,7 @@ COMMIT_USERNAME=$INPUT_COMMIT_USERNAME COMMIT_EMAIL=$INPUT_COMMIT_EMAIL SSH_PRIVATE_KEY=$INPUT_SSH_PRIVATE_KEY -export HOME=/home/builder +export HOME=/root echo "---------------- AUR Package version $PKGNAME/$PKGVER ----------------" From aaabf0996d5cd8b98aaaa4dbcbef391ec4200911 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 18:48:09 +0700 Subject: [PATCH 34/94] Use ~ in place of $HOME --- entrypoint.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f51d1f0..57f0400 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,15 +8,13 @@ COMMIT_USERNAME=$INPUT_COMMIT_USERNAME COMMIT_EMAIL=$INPUT_COMMIT_EMAIL SSH_PRIVATE_KEY=$INPUT_SSH_PRIVATE_KEY -export HOME=/root - echo "---------------- AUR Package version $PKGNAME/$PKGVER ----------------" -ssh-keyscan -t ed25519 aur.archlinux.org >> $HOME/.ssh/known_hosts +ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts -echo -e "${SSH_PRIVATE_KEY//_/\\n}" > $HOME/.ssh/aur +echo -e "${SSH_PRIVATE_KEY//_/\\n}" > ~/.ssh/aur -chmod 600 $HOME/.ssh/aur* +chmod 600 ~/.ssh/aur* git config --global user.name "$COMMIT_USERNAME" git config --global user.email "$COMMIT_EMAIL" From 9a31bb948c1e693b094872962e5c105978495f1b Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 18:49:21 +0700 Subject: [PATCH 35/94] Remove makepkg -c --- entrypoint.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 57f0400..69a53f2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -32,9 +32,6 @@ echo "------------- BUILDING PKG $PKGNAME ----------------" sed -i "s/pkgver=.*$/pkgver=$PKGVER/" PKGBUILD sed -i "s/sha256sums=.*$/$(makepkg -g 2>/dev/null)/" PKGBUILD -# Test build -makepkg -c - # Update srcinfo makepkg --printsrcinfo > .SRCINFO From 45dbeb6447b31f31d4f629bc52d2e4b074373ed2 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 18:49:45 +0700 Subject: [PATCH 36/94] Remove an empty line --- entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 69a53f2..1907bf8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -35,7 +35,6 @@ sed -i "s/sha256sums=.*$/$(makepkg -g 2>/dev/null)/" PKGBUILD # Update srcinfo makepkg --printsrcinfo > .SRCINFO - echo "------------- BUILD DONE ----------------" # Update aur From 5b9a4e75a2bebdc15080505f33758ae803724765 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:09:07 +0700 Subject: [PATCH 37/94] Add inputs.commit_message --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index 5ffd02d..ff25cee 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,10 @@ inputs: 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' runs: using: 'docker' image: 'Dockerfile' From 858c6c3c68c7d59f5a316cb21701b0925ba74087 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:13:17 +0700 Subject: [PATCH 38/94] Update entrypoint.sh --- entrypoint.sh | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 1907bf8..42113e9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,44 +2,32 @@ set -o errexit -o pipefail -o nounset -PKGNAME=$INPUT_PKGNAME -PKGVER=${INPUT_PKGVER} -COMMIT_USERNAME=$INPUT_COMMIT_USERNAME -COMMIT_EMAIL=$INPUT_COMMIT_EMAIL -SSH_PRIVATE_KEY=$INPUT_SSH_PRIVATE_KEY - -echo "---------------- AUR Package version $PKGNAME/$PKGVER ----------------" +pkgname=$INPUT_PKGNAME +pkgbuild=$INPUT_PKGBUILD +commit_username=$INPUT_COMMIT_USERNAME +commit_email=$INPUT_COMMIT_EMAIL +ssh_private_key=$INPUT_SSH_PRIVATE_KEY +commit_message=$INPUT_COMMIT_MESSAGE ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts -echo -e "${SSH_PRIVATE_KEY//_/\\n}" > ~/.ssh/aur +echo -e "${ssh_private_key//_/\\n}" > ~/.ssh/aur chmod 600 ~/.ssh/aur* -git config --global user.name "$COMMIT_USERNAME" -git config --global user.email "$COMMIT_EMAIL" - -REPO_URL="ssh://aur@aur.archlinux.org/${PKGNAME}.git" - -echo "---------------- $REPO_URL ----------------" +git config --global user.name "$commit_username" +git config --global user.email "$commit_email" -cd /tmp -git clone "$REPO_URL" -cd "$PKGNAME" +repo_url="ssh://aur@aur.archlinux.org/${pkgname}.git" -echo "------------- BUILDING PKG $PKGNAME ----------------" +git clone "$repo_url" /local-repo -sed -i "s/pkgver=.*$/pkgver=$PKGVER/" PKGBUILD -sed -i "s/sha256sums=.*$/$(makepkg -g 2>/dev/null)/" PKGBUILD +echo "Copying PKGBUILD from $pkgbuild to /local-repo" +cp -v "$pkgbuild" /local-repo/PKGBUILD -# Update srcinfo -makepkg --printsrcinfo > .SRCINFO +echo "Updating .SRCINFO" +makepkg --printsrcinfo > /local-repo/.SRCINFO -echo "------------- BUILD DONE ----------------" - -# Update aur -git add --force PKGBUILD .SRCINFO -git commit --allow-empty -m "Update to $PKGVER" +git add -fv PKGBUILD .SRCINFO +git commit --allow-empty -m "$commit_message" git push --force - -echo "------------- PUBLISH DONE ----------------" From c1376202572fee1696e98cbb0dedfcaa0d5da0e4 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:15:49 +0700 Subject: [PATCH 39/94] Remove unnecessary package: go-pie --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5da7f27..7fe3163 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM archlinux/base RUN pacman -Sy && \ pacman -Sy --noconfirm openssh \ - git fakeroot binutils go-pie gcc awk binutils xz \ + git fakeroot binutils gcc awk binutils xz \ libarchive bzip2 coreutils file findutils \ gettext grep gzip sed ncurses From adaac6ffb1d3262e7951cb89d674abd1a1358f0d Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:18:04 +0700 Subject: [PATCH 40/94] Add -v --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 42113e9..af440d8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,4 +30,4 @@ makepkg --printsrcinfo > /local-repo/.SRCINFO git add -fv PKGBUILD .SRCINFO git commit --allow-empty -m "$commit_message" -git push --force +git push -fv From 8db3edd2a0428bf809866f47c588f4ef11264c46 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:34:51 +0700 Subject: [PATCH 41/94] Make inputs.ssh_private_key simpler --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index af440d8..4453b17 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,7 +11,7 @@ commit_message=$INPUT_COMMIT_MESSAGE ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts -echo -e "${ssh_private_key//_/\\n}" > ~/.ssh/aur +echo "$ssh_private_key" > ~/.ssh/aur chmod 600 ~/.ssh/aur* From 7ba867fba220b939ef7612acc2627d37cf04a19b Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:40:11 +0700 Subject: [PATCH 42/94] Add more logs --- entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 4453b17..2478023 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,17 +9,20 @@ commit_email=$INPUT_COMMIT_EMAIL ssh_private_key=$INPUT_SSH_PRIVATE_KEY commit_message=$INPUT_COMMIT_MESSAGE +echo 'Adding aur.archlinux.org to known hosts...' ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts +echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur - chmod 600 ~/.ssh/aur* +echo 'Configuring git...' git config --global user.name "$commit_username" git config --global user.email "$commit_email" repo_url="ssh://aur@aur.archlinux.org/${pkgname}.git" +echo "Cloning $repo_url into /local-repo..." git clone "$repo_url" /local-repo echo "Copying PKGBUILD from $pkgbuild to /local-repo" @@ -28,6 +31,7 @@ cp -v "$pkgbuild" /local-repo/PKGBUILD echo "Updating .SRCINFO" makepkg --printsrcinfo > /local-repo/.SRCINFO +echo "Publishing..." git add -fv PKGBUILD .SRCINFO git commit --allow-empty -m "$commit_message" git push -fv From 15ba9f509f0b37ed2e17c0713e59d9e3b118e941 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:46:58 +0700 Subject: [PATCH 43/94] Update README.md --- README.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ed76d12..18291a6 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,15 @@ This action can publish an AUR package. -## Requirements - -This action only modifies existing AUR package and publish it. Make sure targeted package exists first. - ## Inputs ### `pkgname` **Required** The AUR package name you want to update. -### `pkgver` +### `pkgbuild` -**Required** The AUR package version you want to update. +**Required** Path to PKGBUILD file. ### `commit_username` @@ -28,6 +24,9 @@ This action only modifies existing AUR package and publish it. Make sure targete **Required** Your private key with access to AUR package. +### `commit_message` + +**Optional** Commit message to use when creating the new commit. ## Example usage @@ -47,12 +46,9 @@ jobs: uses: KSXGitHub/github-actions-deploy-aur@master with: pkgname: my-awesome-package - pkgver: 1.2.3 + pkgbuild: ./PKGBUILD commit_username: 'Github Action Bot' commit_email: github-action-bot@example.com ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + commit_message: Update AUR package ``` - -## Thanks - -This repository is a fork of https://github.com/guumaster/aur-publish-docker-action.git From 1a838340e9507ca805a3b25255388be3af8fbf8b Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:47:45 +0700 Subject: [PATCH 44/94] Add cd command --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 2478023..358cf38 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -32,6 +32,7 @@ echo "Updating .SRCINFO" makepkg --printsrcinfo > /local-repo/.SRCINFO echo "Publishing..." +cd /local-repo git add -fv PKGBUILD .SRCINFO git commit --allow-empty -m "$commit_message" git push -fv From c1453cc0d8a6e144114531cff830cf826c5f4fef Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:51:44 +0700 Subject: [PATCH 45/94] Consistent descriptions --- README.md | 4 ++-- action.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 18291a6..a4059f8 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Publish AUR packages -This action can publish an AUR package. +GitHub Actions to publish AUR package. ## Inputs ### `pkgname` -**Required** The AUR package name you want to update. +**Required** AUR package name. ### `pkgbuild` diff --git a/action.yml b/action.yml index ff25cee..b501293 100644 --- a/action.yml +++ b/action.yml @@ -13,10 +13,10 @@ inputs: description: 'Path to PKGBUILD file' required: true commit_username: - description: 'The username to use when creating the new commit.' + description: 'The username to use when creating the new commit' required: true commit_email: - description: 'The email to use when creating the new commit.' + description: 'The email to use when creating the new commit' required: true ssh_private_key: description: 'Your private key with access to AUR package.' From a56e0367279f7af18303719ac95fb9604fa7edd6 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 20:01:17 +0700 Subject: [PATCH 46/94] Create github workflows --- .github/workflows/test-aur.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/test-aur.yaml diff --git a/.github/workflows/test-aur.yaml b/.github/workflows/test-aur.yaml new file mode 100644 index 0000000..02b395a --- /dev/null +++ b/.github/workflows/test-aur.yaml @@ -0,0 +1,20 @@ +name: Test publishing AUR package + +on: + - push + +jobs: + publish_aur_package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Publish AUR package + uses: ./ + with: + pkgname: test-publishing-aur-package-using-github-action-0 + pkgbuild: ./PKGBUILD + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + commit_message: Publish an AUR package from GitHub Actions From 67e40da1bbeb656d7b32b8d518c8f684f9a6ed32 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 20:02:15 +0700 Subject: [PATCH 47/94] Correct example --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a4059f8..ac31639 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ jobs: aur-publish: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v2 + - name: Publish AUR package uses: KSXGitHub/github-actions-deploy-aur@master with: From efc5c53f4adcacf067cbadd7c608f0fed7c2ddca Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 20:03:29 +0700 Subject: [PATCH 48/94] Encourage user hiding identity behind secrets --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ac31639..96c0274 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,8 @@ jobs: with: pkgname: my-awesome-package pkgbuild: ./PKGBUILD - commit_username: 'Github Action Bot' - commit_email: github-action-bot@example.com + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: Update AUR package ``` From d5ef684fef19fcb3d941a4023662739c59968009 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 20:08:59 +0700 Subject: [PATCH 49/94] Tell user how to create secrets --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 96c0274..376fe62 100644 --- a/README.md +++ b/README.md @@ -54,3 +54,5 @@ jobs: ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: Update AUR package ``` + +**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). From 0d9f35de7adf94f153e2bd148d9e80c288299bcb Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 20:20:41 +0700 Subject: [PATCH 50/94] Create PKGBUILD --- PKGBUILD | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 PKGBUILD diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..19d5e76 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,20 @@ +# Maintainer: Hoàng Văn Khải + +pkgname=test-publishing-aur-package-using-github-action-0 +pkgver=0.0.0 +pkgrel=0 +pkgdesc='This is a test package. It serves no other purposes.' +url='https://github.com/KSXGitHub/github-actions-deploy-aur.git' +arch=(any) +license=(WTFPL-2.0) +source=() +sha512sums=() + +package() { + msg 'Generating executable...' + ( + echo '#!/bin/sh' + echo 'echo Success' + ) > /usr/bin/test-publishing-aur-package-using-github-action-0 + chmod a+x /usr/bin/test-publishing-aur-package-using-github-action-0 +} From 9ef918abd87bf85fdd990522e4c74005280cc140 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 20:32:55 +0700 Subject: [PATCH 51/94] Move init of ssh from Dockerfile to entrypoint.sh --- Dockerfile | 6 +----- entrypoint.sh | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7fe3163..f266b02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,11 +6,7 @@ RUN pacman -Sy && \ libarchive bzip2 coreutils file findutils \ gettext grep gzip sed ncurses -RUN mkdir -p /root/.ssh -RUN touch /root/.ssh/known_hosts -COPY ssh_config /root/.ssh/config -RUN chmod 600 /root/.ssh/* -R - COPY entrypoint.sh /entrypoint.sh +COPY ssh_config /ssh_config ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index 358cf38..1c55034 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,6 +9,12 @@ commit_email=$INPUT_COMMIT_EMAIL ssh_private_key=$INPUT_SSH_PRIVATE_KEY commit_message=$INPUT_COMMIT_MESSAGE +echo 'Initializing ssh directory...' +mkdir -pv ~/.ssh +touch ~/.ssh/known_hosts +cp -v /ssh_config ~/.ssh/config +chmod -v 600 ~/.ssh/* + echo 'Adding aur.archlinux.org to known hosts...' ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts From 2746e34065c113acfe812c3a90e128bd6a82128a Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 20:46:18 +0700 Subject: [PATCH 52/94] Add inputs.ssh_keyscan_types --- README.md | 5 +++++ action.yml | 6 +++++- entrypoint.sh | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 376fe62..587f655 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,10 @@ GitHub Actions to publish AUR package. **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 @@ -53,6 +57,7 @@ jobs: 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). diff --git a/action.yml b/action.yml index b501293..4cf67a6 100644 --- a/action.yml +++ b/action.yml @@ -22,9 +22,13 @@ inputs: description: 'Your private key with access to AUR package.' required: true commit_message: - description: 'Commit message to use when creating the new commit.' + 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' diff --git a/entrypoint.sh b/entrypoint.sh index 1c55034..b9d31bc 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,6 +8,7 @@ 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 echo 'Initializing ssh directory...' mkdir -pv ~/.ssh @@ -16,7 +17,7 @@ cp -v /ssh_config ~/.ssh/config chmod -v 600 ~/.ssh/* echo 'Adding aur.archlinux.org to known hosts...' -ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts +ssh-keyscan -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur From f1ce6f36f702bb5e43ee0870dd200137dc44c6dd Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:02:46 +0700 Subject: [PATCH 53/94] Fix: secret key names --- .github/workflows/test-aur.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-aur.yaml b/.github/workflows/test-aur.yaml index 02b395a..49fbfe4 100644 --- a/.github/workflows/test-aur.yaml +++ b/.github/workflows/test-aur.yaml @@ -14,7 +14,7 @@ jobs: with: pkgname: test-publishing-aur-package-using-github-action-0 pkgbuild: ./PKGBUILD - commit_username: ${{ secrets.AUR_USERNAME }} - commit_email: ${{ secrets.AUR_EMAIL }} - ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + commit_username: ${{ secrets.TEST_AUR_USERNAME }} + commit_email: ${{ secrets.TEST_AUR_EMAIL }} + ssh_private_key: ${{ secrets.TEST_AUR_SSH_PRIVATE_KEY }} commit_message: Publish an AUR package from GitHub Actions From 4ae1a99a27ed8d71f889556bf13c0385f17df7c7 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:06:04 +0700 Subject: [PATCH 54/94] Define ssh_keyscan_types --- .github/workflows/test-aur.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-aur.yaml b/.github/workflows/test-aur.yaml index 49fbfe4..324ea36 100644 --- a/.github/workflows/test-aur.yaml +++ b/.github/workflows/test-aur.yaml @@ -18,3 +18,4 @@ jobs: commit_email: ${{ secrets.TEST_AUR_EMAIL }} ssh_private_key: ${{ secrets.TEST_AUR_SSH_PRIVATE_KEY }} commit_message: Publish an AUR package from GitHub Actions + ssh_keyscan_types: rsa From 793b4fdeeeae05035508ca29f0e1c3d61d4968ce Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:09:24 +0700 Subject: [PATCH 55/94] Remove aur.archlinux.org before re-adding it --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index b9d31bc..52dab71 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,6 +17,7 @@ cp -v /ssh_config ~/.ssh/config chmod -v 600 ~/.ssh/* echo 'Adding aur.archlinux.org to known hosts...' +ssh-keygen -v -R aur.archlinux.org ssh-keyscan -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' From 332e0de726e216bf63af72bef2d42ea43c08f6a1 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:09:37 +0700 Subject: [PATCH 56/94] Verbose --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 52dab71..1e44d3d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -18,7 +18,7 @@ chmod -v 600 ~/.ssh/* echo 'Adding aur.archlinux.org to known hosts...' ssh-keygen -v -R aur.archlinux.org -ssh-keyscan -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/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 From bacc593de812b9e43dc96cbed6faa4caf2eb7b1c Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:13:14 +0700 Subject: [PATCH 57/94] Use -f option --- entrypoint.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 1e44d3d..0d9aabc 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,8 +17,7 @@ cp -v /ssh_config ~/.ssh/config chmod -v 600 ~/.ssh/* echo 'Adding aur.archlinux.org to known hosts...' -ssh-keygen -v -R aur.archlinux.org -ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts +ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org -f ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur From e4bebcc9765d253ee20dd9660e3bfa17f6587a83 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:26:05 +0700 Subject: [PATCH 58/94] Restore --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 0d9aabc..cb1b97a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,7 +17,7 @@ cp -v /ssh_config ~/.ssh/config chmod -v 600 ~/.ssh/* echo 'Adding aur.archlinux.org to known hosts...' -ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org -f ~/.ssh/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 From 11504aea4b251d61f7fa82644318216b365c7032 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:31:58 +0700 Subject: [PATCH 59/94] Stop defining optional keys --- .github/workflows/test-aur.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test-aur.yaml b/.github/workflows/test-aur.yaml index 324ea36..95987e7 100644 --- a/.github/workflows/test-aur.yaml +++ b/.github/workflows/test-aur.yaml @@ -17,5 +17,3 @@ jobs: commit_username: ${{ secrets.TEST_AUR_USERNAME }} commit_email: ${{ secrets.TEST_AUR_EMAIL }} ssh_private_key: ${{ secrets.TEST_AUR_SSH_PRIVATE_KEY }} - commit_message: Publish an AUR package from GitHub Actions - ssh_keyscan_types: rsa From 709ea65d43e027fce9e3a376874ea0c966a954ca Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:33:06 +0700 Subject: [PATCH 60/94] Rename package --- .github/workflows/test-aur.yaml | 2 +- PKGBUILD | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-aur.yaml b/.github/workflows/test-aur.yaml index 95987e7..976f88f 100644 --- a/.github/workflows/test-aur.yaml +++ b/.github/workflows/test-aur.yaml @@ -12,7 +12,7 @@ jobs: - name: Publish AUR package uses: ./ with: - pkgname: test-publishing-aur-package-using-github-action-0 + pkgname: test-publishing-aur-package-using-github-action-a pkgbuild: ./PKGBUILD commit_username: ${{ secrets.TEST_AUR_USERNAME }} commit_email: ${{ secrets.TEST_AUR_EMAIL }} diff --git a/PKGBUILD b/PKGBUILD index 19d5e76..efa7269 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Hoàng Văn Khải -pkgname=test-publishing-aur-package-using-github-action-0 +pkgname=test-publishing-aur-package-using-github-action-a pkgver=0.0.0 pkgrel=0 pkgdesc='This is a test package. It serves no other purposes.' From b1612288ce2a8015c9f8645d14d9bca44ffb2d4a Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:36:50 +0700 Subject: [PATCH 61/94] Bump pkgrel --- PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index efa7269..36bfada 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ pkgname=test-publishing-aur-package-using-github-action-a pkgver=0.0.0 -pkgrel=0 +pkgrel=1 pkgdesc='This is a test package. It serves no other purposes.' url='https://github.com/KSXGitHub/github-actions-deploy-aur.git' arch=(any) From 67ad17a7bcdb12e58c6a656efcb4d647439cf2ff Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:49:04 +0700 Subject: [PATCH 62/94] Run ssh-add --- entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index cb1b97a..300d71c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,6 +22,8 @@ ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur chmod 600 ~/.ssh/aur* +ssh_agent=$(eval "$(ssh-agent -s)" | awk '{ print $3 }') +ssh-add -v ~/.ssh/aur echo 'Configuring git...' git config --global user.name "$commit_username" @@ -43,3 +45,6 @@ cd /local-repo git add -fv PKGBUILD .SRCINFO git commit --allow-empty -m "$commit_message" git push -fv + +echo 'Finalizing...' +kill --verbose "$ssh_agent" From 6257a0974fe2aefe594971e239555a5bc23258f8 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:49:21 +0700 Subject: [PATCH 63/94] Append 'origin master' --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 300d71c..6e10c9c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -44,7 +44,7 @@ echo "Publishing..." cd /local-repo git add -fv PKGBUILD .SRCINFO git commit --allow-empty -m "$commit_message" -git push -fv +git push -fv origin master echo 'Finalizing...' kill --verbose "$ssh_agent" From ddb6690e8413ba9c06cc925d0e47c6fabc90789f Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:57:59 +0700 Subject: [PATCH 64/94] Add all --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6e10c9c..24708ff 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -23,7 +23,7 @@ echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur chmod 600 ~/.ssh/aur* ssh_agent=$(eval "$(ssh-agent -s)" | awk '{ print $3 }') -ssh-add -v ~/.ssh/aur +ssh-add -v ~/.ssh/* echo 'Configuring git...' git config --global user.name "$commit_username" From 886dbf1bee0039eb4a4c599eaf1835d13424cd8a Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:58:12 +0700 Subject: [PATCH 65/94] Remove finalization --- entrypoint.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 24708ff..70a184d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -45,6 +45,3 @@ cd /local-repo git add -fv PKGBUILD .SRCINFO git commit --allow-empty -m "$commit_message" git push -fv origin master - -echo 'Finalizing...' -kill --verbose "$ssh_agent" From fc54534fd249cf3d1bb32c65efe62f0999653690 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 21:58:43 +0700 Subject: [PATCH 66/94] Update --- entrypoint.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6e10c9c..ae1ea0e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,8 +22,7 @@ ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur chmod 600 ~/.ssh/aur* -ssh_agent=$(eval "$(ssh-agent -s)" | awk '{ print $3 }') -ssh-add -v ~/.ssh/aur +ssh-add -v ~/.ssh/* echo 'Configuring git...' git config --global user.name "$commit_username" @@ -45,6 +44,3 @@ cd /local-repo git add -fv PKGBUILD .SRCINFO git commit --allow-empty -m "$commit_message" git push -fv origin master - -echo 'Finalizing...' -kill --verbose "$ssh_agent" From 3ce8962577bfd16e3601212cf040a2319cb538f1 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 22:06:19 +0700 Subject: [PATCH 67/94] ssh-agent --- entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index ae1ea0e..8ef555e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,6 +22,7 @@ ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur chmod 600 ~/.ssh/aur* +ssh_agent=$(eval "$(ssh-agent)" | awk '{ print $3 }') ssh-add -v ~/.ssh/* echo 'Configuring git...' @@ -44,3 +45,6 @@ cd /local-repo git add -fv PKGBUILD .SRCINFO git commit --allow-empty -m "$commit_message" git push -fv origin master + +echo 'Finalizing...' +kill "$ssh_agent" From 0bb99bac35078976012838cdc46c9221897ff727 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 22:10:05 +0700 Subject: [PATCH 68/94] Start sshd.service --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 8ef555e..685c87c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,6 +22,7 @@ ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur chmod 600 ~/.ssh/aur* +systemctl start sshd ssh_agent=$(eval "$(ssh-agent)" | awk '{ print $3 }') ssh-add -v ~/.ssh/* From 757efe30d1eef85071f4a417a9b9388ec8466248 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 22:13:49 +0700 Subject: [PATCH 69/94] Stop using systemctl --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 685c87c..fa982f6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,7 +22,7 @@ ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur chmod 600 ~/.ssh/aur* -systemctl start sshd +sshd ssh_agent=$(eval "$(ssh-agent)" | awk '{ print $3 }') ssh-add -v ~/.ssh/* From bcfcd5d91a0aca0b8b3475b95a13df40b77f9a15 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 22:15:31 +0700 Subject: [PATCH 70/94] /usr/bin/sshd --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index fa982f6..f9e0c42 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,7 +22,7 @@ ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur chmod 600 ~/.ssh/aur* -sshd +/usr/bin/sshd ssh_agent=$(eval "$(ssh-agent)" | awk '{ print $3 }') ssh-add -v ~/.ssh/* From f39b794d54bbc1395ab37396ee03e3e1f370e6c9 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 22:17:10 +0700 Subject: [PATCH 71/94] Revert --- entrypoint.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f9e0c42..99099d9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,9 +22,6 @@ ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur chmod 600 ~/.ssh/aur* -/usr/bin/sshd -ssh_agent=$(eval "$(ssh-agent)" | awk '{ print $3 }') -ssh-add -v ~/.ssh/* echo 'Configuring git...' git config --global user.name "$commit_username" @@ -46,6 +43,3 @@ cd /local-repo git add -fv PKGBUILD .SRCINFO git commit --allow-empty -m "$commit_message" git push -fv origin master - -echo 'Finalizing...' -kill "$ssh_agent" From 04d57f14be9db969cb51b5c9f12a6d49cee0f9a0 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 22:20:34 +0700 Subject: [PATCH 72/94] Try this --- entrypoint.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 99099d9..22e057a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -27,10 +27,8 @@ echo 'Configuring git...' git config --global user.name "$commit_username" git config --global user.email "$commit_email" -repo_url="ssh://aur@aur.archlinux.org/${pkgname}.git" - -echo "Cloning $repo_url into /local-repo..." -git clone "$repo_url" /local-repo +echo "Cloning AUR package into /local-repo..." +git clone "https://aur.archlinux.org/{pkgname}.git" /local-repo echo "Copying PKGBUILD from $pkgbuild to /local-repo" cp -v "$pkgbuild" /local-repo/PKGBUILD @@ -40,6 +38,7 @@ makepkg --printsrcinfo > /local-repo/.SRCINFO echo "Publishing..." cd /local-repo +git remote add aur "ssh://aur@aur.archlinux.org/${pkgname}.git" git add -fv PKGBUILD .SRCINFO git commit --allow-empty -m "$commit_message" -git push -fv origin master +git push -fv aur master From bc2ba0ee9e3512cd5f21ba2a5b08b72996d85ff3 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 22:22:04 +0700 Subject: [PATCH 73/94] Fix env --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 22e057a..cfd7525 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,7 +28,7 @@ git config --global user.name "$commit_username" git config --global user.email "$commit_email" echo "Cloning AUR package into /local-repo..." -git clone "https://aur.archlinux.org/{pkgname}.git" /local-repo +git clone "https://aur.archlinux.org/${pkgname}.git" /local-repo echo "Copying PKGBUILD from $pkgbuild to /local-repo" cp -v "$pkgbuild" /local-repo/PKGBUILD From 6eb1d486205b090fcdd565f0dbc3758d70f97619 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 22:27:08 +0700 Subject: [PATCH 74/94] sudo --- Dockerfile | 2 +- entrypoint.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f266b02..ba26fff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM archlinux/base RUN pacman -Sy && \ - pacman -Sy --noconfirm openssh \ + pacman -Sy --noconfirm openssh sudo \ git fakeroot binutils gcc awk binutils xz \ libarchive bzip2 coreutils file findutils \ gettext grep gzip sed ncurses diff --git a/entrypoint.sh b/entrypoint.sh index cfd7525..df2f9e7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,5 @@ #!/bin/bash +# shellcheck disable=SC2024 set -o errexit -o pipefail -o nounset @@ -34,7 +35,7 @@ echo "Copying PKGBUILD from $pkgbuild to /local-repo" cp -v "$pkgbuild" /local-repo/PKGBUILD echo "Updating .SRCINFO" -makepkg --printsrcinfo > /local-repo/.SRCINFO +sudo makepkg --printsrcinfo > /local-repo/.SRCINFO echo "Publishing..." cd /local-repo From 33d52c93994c01db34aa642e59896104f669149c Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:10:59 +0700 Subject: [PATCH 75/94] Split user --- Dockerfile | 3 ++- build.sh | 40 ++++++++++++++++++++++++++++++++++++++++ entrypoint.sh | 48 ++++++++++++------------------------------------ 3 files changed, 54 insertions(+), 37 deletions(-) create mode 100755 build.sh diff --git a/Dockerfile b/Dockerfile index ba26fff..9cdeabb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,10 @@ RUN pacman -Sy && \ pacman -Sy --noconfirm openssh sudo \ git fakeroot binutils gcc awk binutils xz \ libarchive bzip2 coreutils file findutils \ - gettext grep gzip sed ncurses + 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"] diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..7213f27 --- /dev/null +++ b/build.sh @@ -0,0 +1,40 @@ +#!/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...' +printf %s "$ssh_private_key" > ~/.ssh/aur +chmod -v 600 ~/.ssh/aur* + +echo 'Configuring git...' +git config --global user.name "$commit_username" +git config --global user.email "$commit_email" + +echo 'Cloning AUR package into /local-repo...' +git clone "https://aur.archlinux.org/${pkgname}.git" /local-repo +cd /local-repo + +echo 'Copying PKGBUILD...' +cp -v /PKGBUILD ./ + +echo "Updating .SRCINFO" +sudo makepkg --printsrcinfo > .SRCINFO + +echo "Publishing..." +git remote add aur "ssh://aur@aur.archlinux.org/${pkgname}.git" +git add -fv PKGBUILD .SRCINFO +git commit --allow-empty -m "$commit_message" +git push -fv aur master diff --git a/entrypoint.sh b/entrypoint.sh index df2f9e7..525561d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,45 +1,21 @@ #!/bin/bash -# shellcheck disable=SC2024 set -o errexit -o pipefail -o nounset -pkgname=$INPUT_PKGNAME pkgbuild=$INPUT_PKGBUILD -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 -echo 'Initializing ssh directory...' -mkdir -pv ~/.ssh -touch ~/.ssh/known_hosts -cp -v /ssh_config ~/.ssh/config -chmod -v 600 ~/.ssh/* - -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 600 ~/.ssh/aur* +echo 'Creating builder user...' +useradd --create-home --shell /bin/bash builder -echo 'Configuring git...' -git config --global user.name "$commit_username" -git config --global user.email "$commit_email" - -echo "Cloning AUR package into /local-repo..." -git clone "https://aur.archlinux.org/${pkgname}.git" /local-repo - -echo "Copying PKGBUILD from $pkgbuild to /local-repo" -cp -v "$pkgbuild" /local-repo/PKGBUILD +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 ~/.ssh/* -echo "Updating .SRCINFO" -sudo makepkg --printsrcinfo > /local-repo/.SRCINFO +echo 'Copying PKGBUILD...' +cp -r "$pkgbuild" /PKGBUILD -echo "Publishing..." -cd /local-repo -git remote add aur "ssh://aur@aur.archlinux.org/${pkgname}.git" -git add -fv PKGBUILD .SRCINFO -git commit --allow-empty -m "$commit_message" -git push -fv aur master +echo 'Running build.sh...' +exec runuser builder --login --command '/build.sh' From a44f95d93b0f905b40362e576ece89f9d6048088 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:14:48 +0700 Subject: [PATCH 76/94] Fix path --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 525561d..3eb7e21 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,7 +12,7 @@ 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 ~/.ssh/* +chmod -vR 600 /home/builder/.ssh/* echo 'Copying PKGBUILD...' cp -r "$pkgbuild" /PKGBUILD From e43005af072f98d44e556d92ea5057c71ea65864 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:15:07 +0700 Subject: [PATCH 77/94] Recursive --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 7213f27..0e46a08 100755 --- a/build.sh +++ b/build.sh @@ -17,7 +17,7 @@ ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' printf %s "$ssh_private_key" > ~/.ssh/aur -chmod -v 600 ~/.ssh/aur* +chmod -vR 600 ~/.ssh/aur* echo 'Configuring git...' git config --global user.name "$commit_username" From 2338ec29d0de1c34cf613f8dd85cd9e64e790117 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:19:19 +0700 Subject: [PATCH 78/94] No --login --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3eb7e21..f1621d0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -18,4 +18,4 @@ echo 'Copying PKGBUILD...' cp -r "$pkgbuild" /PKGBUILD echo 'Running build.sh...' -exec runuser builder --login --command '/build.sh' +exec runuser builder --command '/build.sh' From 7815778705893c83b48719ff304034b3d1f070e9 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:20:35 +0700 Subject: [PATCH 79/94] Execute via login shell --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index f1621d0..6220be5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -18,4 +18,4 @@ echo 'Copying PKGBUILD...' cp -r "$pkgbuild" /PKGBUILD echo 'Running build.sh...' -exec runuser builder --command '/build.sh' +exec runuser builder --command 'bash -l -c /build.sh' From 67987eb4b7df78cf9c7387cd4bade759adaee6d5 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:23:57 +0700 Subject: [PATCH 80/94] Use /tmp --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 0e46a08..551ffb6 100755 --- a/build.sh +++ b/build.sh @@ -23,9 +23,9 @@ echo 'Configuring git...' git config --global user.name "$commit_username" git config --global user.email "$commit_email" -echo 'Cloning AUR package into /local-repo...' -git clone "https://aur.archlinux.org/${pkgname}.git" /local-repo -cd /local-repo +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 ./ From 6e03ff40a90749f418ebf2c01394593396182b7c Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:28:39 +0700 Subject: [PATCH 81/94] Do not reinstall --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9cdeabb..9917ee9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM archlinux/base RUN pacman -Sy && \ - pacman -Sy --noconfirm openssh sudo \ + 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 From 1b86808853b758e828d59792d3694e69242a2ea8 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:31:56 +0700 Subject: [PATCH 82/94] Remove password --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 6220be5..1e88822 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,6 +6,7 @@ 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 From 3a57107b3921c517f31b64ebc9b7c5bb7b6ce154 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:34:30 +0700 Subject: [PATCH 83/94] Remove sudo Seriously, why is it here in the first place? --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 551ffb6..14b1a78 100755 --- a/build.sh +++ b/build.sh @@ -31,7 +31,7 @@ echo 'Copying PKGBUILD...' cp -v /PKGBUILD ./ echo "Updating .SRCINFO" -sudo makepkg --printsrcinfo > .SRCINFO +makepkg --printsrcinfo > .SRCINFO echo "Publishing..." git remote add aur "ssh://aur@aur.archlinux.org/${pkgname}.git" From f3317563bb6cada00f3fba72c5965a7db9fe2da5 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:42:59 +0700 Subject: [PATCH 84/94] Define ssh_keyscan_types --- .github/workflows/test-aur.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-aur.yaml b/.github/workflows/test-aur.yaml index 976f88f..c4fc0d0 100644 --- a/.github/workflows/test-aur.yaml +++ b/.github/workflows/test-aur.yaml @@ -17,3 +17,4 @@ jobs: commit_username: ${{ secrets.TEST_AUR_USERNAME }} commit_email: ${{ secrets.TEST_AUR_EMAIL }} ssh_private_key: ${{ secrets.TEST_AUR_SSH_PRIVATE_KEY }} + ssh_keyscan_types: rsa From 0d03809956fe58171a6977f20004a76b08c6f179 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:45:04 +0700 Subject: [PATCH 85/94] Is this multi-line? --- .github/workflows/test-aur.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-aur.yaml b/.github/workflows/test-aur.yaml index c4fc0d0..afb4932 100644 --- a/.github/workflows/test-aur.yaml +++ b/.github/workflows/test-aur.yaml @@ -16,5 +16,6 @@ jobs: pkgbuild: ./PKGBUILD commit_username: ${{ secrets.TEST_AUR_USERNAME }} commit_email: ${{ secrets.TEST_AUR_EMAIL }} - ssh_private_key: ${{ secrets.TEST_AUR_SSH_PRIVATE_KEY }} + ssh_private_key: |- + ${{ secrets.TEST_AUR_SSH_PRIVATE_KEY }} ssh_keyscan_types: rsa From 61a1f76e15a221fdaf5e07cd094f8ef5aee99dc9 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:46:45 +0700 Subject: [PATCH 86/94] Revert --- .github/workflows/test-aur.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-aur.yaml b/.github/workflows/test-aur.yaml index afb4932..c4fc0d0 100644 --- a/.github/workflows/test-aur.yaml +++ b/.github/workflows/test-aur.yaml @@ -16,6 +16,5 @@ jobs: pkgbuild: ./PKGBUILD commit_username: ${{ secrets.TEST_AUR_USERNAME }} commit_email: ${{ secrets.TEST_AUR_EMAIL }} - ssh_private_key: |- - ${{ secrets.TEST_AUR_SSH_PRIVATE_KEY }} + ssh_private_key: ${{ secrets.TEST_AUR_SSH_PRIVATE_KEY }} ssh_keyscan_types: rsa From 8fdc115fda438f3473518c3d0b20e940319f56b9 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:48:48 +0700 Subject: [PATCH 87/94] Inspect --- build.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.sh b/build.sh index 14b1a78..1f02b66 100755 --- a/build.sh +++ b/build.sh @@ -19,6 +19,15 @@ echo 'Importing private key...' printf %s "$ssh_private_key" > ~/.ssh/aur chmod -vR 600 ~/.ssh/aur* +echo 'INSPECT' +echo File ~/.ssh/aur +echo 'Lines of keys:' "$(wc -l ~/.ssh/aur)" + +echo ls ~/.ssh +ls ~/ssh + +exit 33 + echo 'Configuring git...' git config --global user.name "$commit_username" git config --global user.email "$commit_email" From bcd1893ceb943a451f39836d8a362f3f2926b790 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:50:53 +0700 Subject: [PATCH 88/94] Fix --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 1f02b66..186419b 100755 --- a/build.sh +++ b/build.sh @@ -24,7 +24,7 @@ echo File ~/.ssh/aur echo 'Lines of keys:' "$(wc -l ~/.ssh/aur)" echo ls ~/.ssh -ls ~/ssh +ls ~/.ssh exit 33 From d704fe96b3a6a869c49354de520670cf07a418a5 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:53:13 +0700 Subject: [PATCH 89/94] Inspect more --- build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 186419b..c900a7d 100755 --- a/build.sh +++ b/build.sh @@ -21,7 +21,8 @@ chmod -vR 600 ~/.ssh/aur* echo 'INSPECT' echo File ~/.ssh/aur -echo 'Lines of keys:' "$(wc -l ~/.ssh/aur)" +echo 'Lines:' "$(wc -l ~/.ssh/aur)" +echo 'Chars:' "$(wc -m ~/.ssh/aur)" echo ls ~/.ssh ls ~/.ssh From 352f882dde4bc5f97d821d4e172acf5c81b633f5 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 11:56:37 +0700 Subject: [PATCH 90/94] Inspect again --- build.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index c900a7d..a9186af 100755 --- a/build.sh +++ b/build.sh @@ -16,7 +16,7 @@ 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...' -printf %s "$ssh_private_key" > ~/.ssh/aur +echo "$ssh_private_key" > ~/.ssh/aur chmod -vR 600 ~/.ssh/aur* echo 'INSPECT' @@ -27,6 +27,9 @@ echo 'Chars:' "$(wc -m ~/.ssh/aur)" echo ls ~/.ssh ls ~/.ssh +echo 'Checksums...' +sha512sum ~/.ssh/aur ~/.ssh/aur.pub + exit 33 echo 'Configuring git...' From 442323e1fbb581323c850aad4d4c75b3fcf95d6a Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 12:01:57 +0700 Subject: [PATCH 91/94] Generate public keys --- build.sh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/build.sh b/build.sh index a9186af..95c6d57 100755 --- a/build.sh +++ b/build.sh @@ -17,21 +17,12 @@ ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur +ssh-keygen -vy -f ~/.ssh/aur > ~/.ssh/aur.pub chmod -vR 600 ~/.ssh/aur* -echo 'INSPECT' -echo File ~/.ssh/aur -echo 'Lines:' "$(wc -l ~/.ssh/aur)" -echo 'Chars:' "$(wc -m ~/.ssh/aur)" - -echo ls ~/.ssh -ls ~/.ssh - -echo 'Checksums...' +echo 'Checksums of SSH keys...' sha512sum ~/.ssh/aur ~/.ssh/aur.pub -exit 33 - echo 'Configuring git...' git config --global user.name "$commit_username" git config --global user.email "$commit_email" From b87197acc8c3d963ff5027aefb483b5489b94c27 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 12:04:22 +0700 Subject: [PATCH 92/94] Switch places --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 95c6d57..5197654 100755 --- a/build.sh +++ b/build.sh @@ -17,8 +17,8 @@ ssh-keyscan -v -t "$ssh_keyscan_types" aur.archlinux.org >> ~/.ssh/known_hosts echo 'Importing private key...' echo "$ssh_private_key" > ~/.ssh/aur -ssh-keygen -vy -f ~/.ssh/aur > ~/.ssh/aur.pub 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 From e92c9823ef47594c2ab4ae7b371328c92d6e0e97 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 12:09:26 +0700 Subject: [PATCH 93/94] Remove ssh_keyscan_types --- .github/workflows/test-aur.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-aur.yaml b/.github/workflows/test-aur.yaml index c4fc0d0..976f88f 100644 --- a/.github/workflows/test-aur.yaml +++ b/.github/workflows/test-aur.yaml @@ -17,4 +17,3 @@ jobs: commit_username: ${{ secrets.TEST_AUR_USERNAME }} commit_email: ${{ secrets.TEST_AUR_EMAIL }} ssh_private_key: ${{ secrets.TEST_AUR_SSH_PRIVATE_KEY }} - ssh_keyscan_types: rsa From 12eaec4aa4d1e4345894b28a496f73bfbc6d8370 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 7 May 2020 12:10:00 +0700 Subject: [PATCH 94/94] Bump pkgrel --- PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index 36bfada..5b85a8f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ pkgname=test-publishing-aur-package-using-github-action-a pkgver=0.0.0 -pkgrel=1 +pkgrel=2 pkgdesc='This is a test package. It serves no other purposes.' url='https://github.com/KSXGitHub/github-actions-deploy-aur.git' arch=(any) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy