Skip to content

Commit f0c37ce

Browse files
committed
feat: Copy all package files, not just PKGBUILD
Also update CI workflow to test against a package with multiple source files. This fixes #31
1 parent ee5d6e8 commit f0c37ce

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,28 @@ jobs:
2424
sed -i 's/.*image\:.*/ image\: \"Dockerfile\"/' action.yml
2525
cat action.yml
2626
27-
- name: Get sample PKGBUILD
28-
run: wget https://github.com/${{ github.repository_owner }}/plenti-bin/raw/f5ffaaee02a2119aa16f6b7a27e87e198e096b47/PKGBUILD
29-
27+
- name: Get sample package
28+
run: |
29+
mkdir visual-studio-code-bin
30+
pushd visual-studio-code-bin
31+
wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/PKGBUILD
32+
wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/.SRCINFO
33+
wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/visual-studio-code-bin.install
34+
wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/visual-studio-code-bin.sh
35+
popd
3036
- name: Running test
3137
uses: ./
3238
with:
33-
pkgver: '0.4.26'
34-
pkgrel: 2
39+
pkgver: '1.100.1'
40+
pkgrel: 1
3541
updpkgsums: true
3642
srcinfo: true
43+
path: 'visual-studio-code-bin'
3744

3845
- name: Show diff
3946
run: |
4047
ls -la
41-
git diff PKGBUILD
42-
git diff .SRCINFO
48+
git diff
4349
4450
publish:
4551
name: Publish OCI image
@@ -126,8 +132,7 @@ jobs:
126132
- name: Show diff
127133
run: |
128134
ls -la
129-
git diff PKGBUILD
130-
git diff .SRCINFO
135+
git diff
131136
132137
release:
133138
name: Release

entrypoint.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@
22
set -e
33

44
# Set path
5-
WORKPATH=$GITHUB_WORKSPACE/$INPUT_PATH
65
HOME=/home/builder
7-
echo "::group::Copying files from $WORKPATH to $HOME/gh-action"
6+
echo "::group::Copying files from $GITHUB_WORKSPACE to $HOME/gh-action"
87
# Set path permision
98
cd $HOME
109
mkdir gh-action
1110
cd gh-action
12-
cp -rfv "$GITHUB_WORKSPACE"/.git ./
13-
cp -fv "$WORKPATH"/PKGBUILD ./
11+
12+
# If there is a custom path, we need to copy the whole repository
13+
# because we run "git diff" at several stages and without the entire
14+
# tree the output will be incorrect.
15+
if [[ -n $INPUT_PATH ]]; then
16+
cp -rTfv "$GITHUB_WORKSPACE"/ ./
17+
cd $INPUT_PATH
18+
else
19+
# Without a custom path though, we can just grab the .git directory and the PKGBUILD.
20+
cp -rfv "$GITHUB_WORKSPACE"/.git ./
21+
cp -fv "$GITHUB_WORKSPACE"/PKGBUILD ./
22+
fi
1423
echo "::endgroup::"
1524

1625
# Update archlinux-keyring
@@ -28,7 +37,7 @@ if [[ -n $INPUT_PKGVER ]]; then
2837
echo "::endgroup::"
2938
fi
3039

31-
# Update pkgver
40+
# Update pkgrel
3241
if [[ -n $INPUT_PKGREL ]]; then
3342
echo "::group::Updating pkgrel on PKGBUILD"
3443
sed -i "s:^pkgrel=.*$:pkgrel=$INPUT_PKGREL:g" PKGBUILD
@@ -74,6 +83,8 @@ if [[ -n $INPUT_FLAGS ]]; then
7483
echo "::endgroup::"
7584
fi
7685

86+
WORKPATH=$GITHUB_WORKSPACE/$INPUT_PATH
87+
WORKPATH=${WORKPATH%/} # Remove trailing slash if $INPUT_PATH is empty
7788
echo "::group::Copying files from $HOME/gh-action to $WORKPATH"
7889
sudo cp -fv PKGBUILD "$WORKPATH"/PKGBUILD
7990
if [[ -e .SRCINFO ]]; then

0 commit comments

Comments
 (0)