diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 33dc48d..6806f63 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,22 +24,28 @@ jobs: sed -i 's/.*image\:.*/ image\: \"Dockerfile\"/' action.yml cat action.yml - - name: Get sample PKGBUILD - run: wget https://github.com/${{ github.repository_owner }}/plenti-bin/raw/f5ffaaee02a2119aa16f6b7a27e87e198e096b47/PKGBUILD - + - name: Get sample package + run: | + mkdir visual-studio-code-bin + pushd visual-studio-code-bin + wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/PKGBUILD + wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/.SRCINFO + wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/visual-studio-code-bin.install + wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/visual-studio-code-bin.sh + popd - name: Running test uses: ./ with: - pkgver: '0.4.26' - pkgrel: 2 + pkgver: '1.100.1' + pkgrel: 1 updpkgsums: true srcinfo: true + path: 'visual-studio-code-bin' - name: Show diff run: | ls -la - git diff PKGBUILD - git diff .SRCINFO + git diff publish: name: Publish OCI image @@ -126,8 +132,7 @@ jobs: - name: Show diff run: | ls -la - git diff PKGBUILD - git diff .SRCINFO + git diff release: name: Release diff --git a/entrypoint.sh b/entrypoint.sh index b0808c0..22da8c4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,15 +2,24 @@ set -e # Set path -WORKPATH=$GITHUB_WORKSPACE/$INPUT_PATH HOME=/home/builder -echo "::group::Copying files from $WORKPATH to $HOME/gh-action" +echo "::group::Copying files from $GITHUB_WORKSPACE to $HOME/gh-action" # Set path permision cd $HOME mkdir gh-action cd gh-action -cp -rfv "$GITHUB_WORKSPACE"/.git ./ -cp -fv "$WORKPATH"/PKGBUILD ./ + +# If there is a custom path, we need to copy the whole repository +# because we run "git diff" at several stages and without the entire +# tree the output will be incorrect. +if [[ -n $INPUT_PATH ]]; then + cp -rTfv "$GITHUB_WORKSPACE"/ ./ + cd $INPUT_PATH +else + # Without a custom path though, we can just grab the .git directory and the PKGBUILD. + cp -rfv "$GITHUB_WORKSPACE"/.git ./ + cp -fv "$GITHUB_WORKSPACE"/PKGBUILD ./ +fi echo "::endgroup::" # Update archlinux-keyring @@ -28,7 +37,7 @@ if [[ -n $INPUT_PKGVER ]]; then echo "::endgroup::" fi -# Update pkgver +# Update pkgrel if [[ -n $INPUT_PKGREL ]]; then echo "::group::Updating pkgrel on PKGBUILD" sed -i "s:^pkgrel=.*$:pkgrel=$INPUT_PKGREL:g" PKGBUILD @@ -74,6 +83,8 @@ if [[ -n $INPUT_FLAGS ]]; then echo "::endgroup::" fi +WORKPATH=$GITHUB_WORKSPACE/$INPUT_PATH +WORKPATH=${WORKPATH%/} # Remove trailing slash if $INPUT_PATH is empty echo "::group::Copying files from $HOME/gh-action to $WORKPATH" sudo cp -fv PKGBUILD "$WORKPATH"/PKGBUILD if [[ -e .SRCINFO ]]; then