Skip to content

Commit 89d9989

Browse files
committed
aur installation fixed
1 parent b970885 commit 89d9989

2 files changed

Lines changed: 35 additions & 23 deletions

File tree

.github/workflows/release.yml

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,13 @@ jobs:
6565
files: |
6666
gpt-cli.gnu
6767
gpt-cli.gnu.sha256.txt
68-
- name: Update fallback release URL
69-
run: sed -i "s|FALLBACK_RELEASE_URL=.*|FALLBACK_RELEASE_URL=https://api.github.com/repos/gustawdaniel/gpt-cli/releases/${{ github.event.release.id }}|" install.sh
68+
- name: Patch install.sh with release URL if release exists
69+
run: |
70+
if [ -n "${{ github.event.release.id }}" ]; then
71+
sed -i "s|FALLBACK_RELEASE_URL=.*|FALLBACK_RELEASE_URL=https://api.github.com/repos/gustawdaniel/gpt-cli/releases/${{ github.event.release.id }}|" install.sh
72+
else
73+
echo "No release ID found, skipping patch."
74+
fi
7075
- name: Commit changes
7176
uses: EndBug/add-and-commit@v9
7277
with:
@@ -85,54 +90,61 @@ jobs:
8590
env:
8691
TAG: ${{ needs.resolve-tag.outputs.tag }}
8792
steps:
88-
- name: Install base-devel
93+
- name: Install base-devel and utilities
8994
run: |
90-
pacman -Syu --noconfirm base-devel wget bc
95+
pacman -Syu --noconfirm base-devel wget bc curl git
96+
9197
- name: Derive version values from tag
9298
run: |
9399
echo "PKGVER=$(echo '${TAG}' | sed 's/^v//')" >> $GITHUB_ENV
94-
echo "PKGREL=$(echo "1+$(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=gpt-cli" | grep ^pkgrel= | cut -d "=" -f 2)" | bc)" >> $GITHUB_ENV
95-
- name: Use release information
100+
PKGREL=$(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=gpt-cli" | grep ^pkgrel= | cut -d "=" -f 2)
101+
echo "PKGREL=$((PKGREL + 1))" >> $GITHUB_ENV
102+
103+
- name: Show derived values
96104
run: |
97-
echo "Using PKGVER: ${PKGVER} and PKGREL: ${PKGREL}"
98-
- run: echo ${{ env.PKGVER }}
99-
- run: echo ${{ env.PKGREL }}
100-
- name: Setup environment2
105+
echo "PKGVER=${PKGVER}"
106+
echo "PKGREL=${PKGREL}"
107+
108+
- name: Download binary and calculate checksum
101109
run: |
102-
wget "https://github.com/gustawdaniel/gpt-cli/releases/download/v${{ env.PKGVER }}/gpt-cli.gnu" -O gpt-cli.gnu
103-
echo "CHECKSUM=$(sha512sum gpt-cli.gnu | cut -d " " -f 1)" >> $GITHUB_ENV
110+
wget "https://github.com/gustawdaniel/gpt-cli/releases/download/v${PKGVER}/gpt-cli.gnu" -O gpt-cli.gnu
111+
echo "CHECKSUM=$(sha512sum gpt-cli.gnu | cut -d ' ' -f 1)" >> $GITHUB_ENV
112+
104113
- name: Prepare PKGBUILD
105114
run: |
106-
cat <<EOT >> PKGBUILD
115+
cat <<EOF > PKGBUILD
107116
pkgname=gpt-cli
108-
pkgver=${{ env.PKGVER }}
109-
pkgrel=${{ env.PKGREL }}
110-
pkgdesc="Run linux commands with natural language. Eg 'show my graphic card' instead 'lspci | grep VGA'"
117+
pkgver=${PKGVER}
118+
pkgrel=${PKGREL}
119+
pkgdesc="Run linux commands with natural language. Eg 'show my graphic card' instead of 'lspci | grep VGA'"
111120
arch=('x86_64')
112121
url="https://github.com/gustawdaniel/gpt-cli"
113122
license=('MIT')
114123
depends=('xorg-server-devel' 'libxcb')
115124
options=()
116-
source_x86_64=("https://github.com/gustawdaniel/gpt-cli/releases/download/v${{ env.PKGVER }}/gpt-cli.gnu")
117-
sha512sums_x86_64=('${{ env.CHECKSUM }}')
118-
125+
source_x86_64=("https://github.com/gustawdaniel/gpt-cli/releases/download/v\${pkgver}/gpt-cli.gnu")
126+
sha512sums_x86_64=('${CHECKSUM}')
127+
119128
package() {
120-
install -Dm755 "\$srcdir/gpt-cli.gnu" "\$pkgdir/usr/bin/gpt-cli"
121-
ln -s "/usr/bin/gpt-cli" "\$pkgdir/usr/bin/p"
129+
install -Dm755 "\$srcdir/gpt-cli.gnu" "\$pkgdir/usr/bin/gpt-cli"
130+
ln -s "/usr/bin/gpt-cli" "\$pkgdir/usr/bin/p"
122131
}
123-
EOT
132+
EOF
133+
124134
- name: Generate .SRCINFO
125135
run: |
126136
useradd -m builduser
127137
passwd -d builduser
128138
echo "builduser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/builduser
129139
chown -R builduser:builduser .
130140
sudo -u builduser bash -c "makepkg --printsrcinfo > .SRCINFO"
141+
131142
- name: Show files
132143
run: |
133144
ls -la
134145
cat PKGBUILD
135146
cat .SRCINFO
147+
136148
- name: Publish AUR package
137149
uses: KSXGitHub/github-actions-deploy-aur@v2.7.0
138150
with:

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Ensure script stops on error
44
set -euo pipefail
55

6-
FALLBACK_RELEASE_URL=https://api.github.com/repos/gustawdaniel/gpt-cli/releases/
6+
FALLBACK_RELEASE_URL=https://api.github.com/repos/gustawdaniel/gpt-cli/releases/96442904
77

88
function set_pkg_manager {
99
if [ "$(uname)" = "Darwin" ]; then

0 commit comments

Comments
 (0)