From 650d2f81f662834529f31d35645e31ba26da8092 Mon Sep 17 00:00:00 2001 From: Gustavo Marin Date: Fri, 27 Mar 2020 17:10:19 +0100 Subject: [PATCH 01/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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 fc2018368350ccf37b8c9e2c62eb462b79860a68 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 5 May 2020 16:38:20 +0700 Subject: [PATCH 29/34] Prepare --- Dockerfile | 18 +----------------- action.yml | 16 ++-------------- entrypoint.sh | 50 ++++---------------------------------------------- 3 files changed, 7 insertions(+), 77 deletions(-) diff --git a/Dockerfile b/Dockerfile index 264408c..e519272 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,7 @@ 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 && \ - 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 - COPY entrypoint.sh /entrypoint.sh -USER builder -WORKDIR /home/builder +COPY "$INPUT_FILENAME" /input_file ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml index 3fabb8b..847d9d4 100644 --- a/action.yml +++ b/action.yml @@ -6,20 +6,8 @@ branding: color: blue icon: package inputs: - 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 - 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.' + filename: + description: File to import required: true runs: diff --git a/entrypoint.sh b/entrypoint.sh index 0286c20..acd2782 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,50 +2,8 @@ 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 "::warning ::inputs.filename = $INPUT_FILENAME" +echo "::warning ::GITHUB_WORKSPACE = $GITHUB_WORKSPACE" -export HOME=/home/builder - -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* || exit $? - -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 ----------------" - -cd /tmp -git clone "$REPO_URL" || exit $? -cd "$PKGNAME" || exit $? - -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 || exit $? - -# Update srcinfo -makepkg --printsrcinfo > .SRCINFO || exit $? - - -echo "------------- BUILD DONE ----------------" - -# Update aur -git add --force PKGBUILD .SRCINFO || exit $? -git commit --allow-empty -m "Update to $PKGVER" || exit $? -git push --force || exit $? - -echo "------------- PUBLISH DONE ----------------" +echo "Displaying content of $INPUT_FILENAME" +cat /input_file From 08ae33adaf11ae9f218e69d87e7c999a838d8a23 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 5 May 2020 16:43:13 +0700 Subject: [PATCH 30/34] Create test workflows --- .github/workflows/test-action.yaml | 16 ++++++++++++++++ input-file.txt | 1 + 2 files changed, 17 insertions(+) create mode 100644 .github/workflows/test-action.yaml create mode 100644 input-file.txt diff --git a/.github/workflows/test-action.yaml b/.github/workflows/test-action.yaml new file mode 100644 index 0000000..768376e --- /dev/null +++ b/.github/workflows/test-action.yaml @@ -0,0 +1,16 @@ +name: Test Action + +on: + - push + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Main Action + uses: ./ + with: + filename: input-file.txt diff --git a/input-file.txt b/input-file.txt new file mode 100644 index 0000000..c70df2e --- /dev/null +++ b/input-file.txt @@ -0,0 +1 @@ +This is the input file... From 628ed630bbb7d0e472a0450e29d000280d3fa9c4 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 5 May 2020 16:57:15 +0700 Subject: [PATCH 31/34] Update --- Dockerfile | 2 +- entrypoint.sh | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e519272..be36ab3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,6 @@ FROM archlinux/base COPY entrypoint.sh /entrypoint.sh -COPY "$INPUT_FILENAME" /input_file +COPY "$INPUT_FILENAME" the_input_file ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index acd2782..c0ca325 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,5 +5,8 @@ set -o errexit -o pipefail -o nounset echo "::warning ::inputs.filename = $INPUT_FILENAME" echo "::warning ::GITHUB_WORKSPACE = $GITHUB_WORKSPACE" -echo "Displaying content of $INPUT_FILENAME" -cat /input_file +echo "Content of $(pwd)" +ls -AR . + +echo "Content of $INPUT_FILENAME" +cat the_input_file/input-file.txt From fd344922c0fc130ba28fc8ec9864d2c27948678b Mon Sep 17 00:00:00 2001 From: khai96_ Date: Tue, 5 May 2020 16:59:39 +0700 Subject: [PATCH 32/34] Try again --- Dockerfile | 2 -- entrypoint.sh | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index be36ab3..69e4807 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,4 @@ FROM archlinux/base COPY entrypoint.sh /entrypoint.sh -COPY "$INPUT_FILENAME" the_input_file - ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index c0ca325..49c1f93 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,7 +6,7 @@ echo "::warning ::inputs.filename = $INPUT_FILENAME" echo "::warning ::GITHUB_WORKSPACE = $GITHUB_WORKSPACE" echo "Content of $(pwd)" -ls -AR . +ls . echo "Content of $INPUT_FILENAME" -cat the_input_file/input-file.txt +cat "$INPUT_FILENAME" From 634b109e7bf801e463324e005a26697b72bb8aca Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:25:11 +0700 Subject: [PATCH 33/34] Test multi-line strings --- .github/workflows/test-action.yaml | 5 +++++ action.yml | 4 +++- entrypoint.sh | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-action.yaml b/.github/workflows/test-action.yaml index 768376e..494608e 100644 --- a/.github/workflows/test-action.yaml +++ b/.github/workflows/test-action.yaml @@ -14,3 +14,8 @@ jobs: uses: ./ with: filename: input-file.txt + paragraph: | + hello there + wow + hi + another line diff --git a/action.yml b/action.yml index 847d9d4..ff67d8f 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,9 @@ inputs: filename: description: File to import required: true - + paragraph: + description: A paragraph + required: true runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 49c1f93..f9c99d9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -10,3 +10,6 @@ ls . echo "Content of $INPUT_FILENAME" cat "$INPUT_FILENAME" + +echo "Content of inputs.paragraph" +echo "$INPUT_PARAGRAPH" From 8f3ff19b5e79dad0a404dfba1071b5ca7a34309f Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 6 May 2020 19:31:17 +0700 Subject: [PATCH 34/34] TEST_LINE_COUNT --- .github/workflows/test-action.yaml | 6 +----- entrypoint.sh | 7 ++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-action.yaml b/.github/workflows/test-action.yaml index 494608e..190285c 100644 --- a/.github/workflows/test-action.yaml +++ b/.github/workflows/test-action.yaml @@ -14,8 +14,4 @@ jobs: uses: ./ with: filename: input-file.txt - paragraph: | - hello there - wow - hi - another line + paragraph: ${{ secrets.TEST_LINE_COUNT }} diff --git a/entrypoint.sh b/entrypoint.sh index f9c99d9..89c0419 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,5 +11,10 @@ ls . echo "Content of $INPUT_FILENAME" cat "$INPUT_FILENAME" +echo "Number of lines of inputs.paragraph" +echo "$INPUT_PARAGRAPH" | wc -l + echo "Content of inputs.paragraph" -echo "$INPUT_PARAGRAPH" +echo "$INPUT_PARAGRAPH" | while read -r line; do + echo 'line>' "$line" +done 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