diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 50d5be5..eff7e6b 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -1,8 +1,8 @@ name: Debug on: - push: - branches: ['*'] +# push: +# branches: ['*'] workflow_dispatch: jobs: @@ -13,32 +13,7 @@ jobs: steps: - name: Install base-devel run: | - pacman -Syu --noconfirm base-devel wget bc git openssh - -# - run: mkdir -p /github/home/.ssh -# - run: ls -la /github/home/.ssh -# - run: | -# cat <> /github/home/.ssh/config -# Host * -# StrictHostKeyChecking no -# UserKnownHostsFile=/dev/null -# EOT -# - run: sudo chmod 400 /github/home/.ssh/config -# - run: echo "${{ secrets.ID_ED25519 }}" > /github/home/.ssh/id_ed25519 -# - run: echo "${{ secrets.ID_ED25519_PUB }}" > /github/home/.ssh/id_ed25519.pub -# - run: chmod 600 /github/home/.ssh/id_ed25519 -# - run: git config --global user.email "gustaw.daniel@gmail.com" -# - run: git config --global user.name "Daniel Gustaw" -# - run: git init -# - run: ls -la /github/home/.ssh -# - run: whoami -# - run: ls -la / -# - run: ls -la /__w -# - run: git config --global --add safe.directory /__w/gpt-cli/gpt-cli -# - run: git remote add aur ssh://aur@aur.archlinux.org/gpt-cli.git -## - run: git config --unset-all http.https://github.com/.extraheader -# - run: GIT_SSH_COMMAND="ssh -i /github/home/.ssh/id_ed25519" git fetch aur master -# - run: la -la + pacman -Syu --noconfirm base-devel wget bc - name: Setup environment run: | @@ -88,17 +63,13 @@ jobs: cat PKGBUILD cat .SRCINFO -# - run: git add PKGBUILD .SRCINFO -# - run: git commit -m "Release ${{ env.PKGVER }}-${{ env.PKGREL }}" -# - run: GIT_SSH_COMMAND="ssh -i /github/home/.ssh/id_ed25519" git push aur HEAD:master - - - name: Publish AUR package - uses: KSXGitHub/github-actions-deploy-aur@v2.7.0 - with: - pkgname: gpt-cli - pkgbuild: ./PKGBUILD - commit_username: gustawdaniel - commit_email: gustaw.daniel@gmail.com - ssh_private_key: ${{ secrets.ID_ED25519 }} - commit_message: Release ${{ env.PKGVER }}-${{ env.PKGREL }} - ssh_keyscan_types: ed25519 \ No newline at end of file +# - name: Publish AUR package +# uses: KSXGitHub/github-actions-deploy-aur@v2.7.0 +# with: +# pkgname: gpt-cli +# pkgbuild: ./PKGBUILD +# commit_username: gustawdaniel +# commit_email: gustaw.daniel@gmail.com +# ssh_private_key: ${{ secrets.ID_ED25519 }} +# commit_message: Release ${{ env.PKGVER }}-${{ env.PKGREL }} +# ssh_keyscan_types: ed25519 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6646f83..857ee22 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,17 +36,80 @@ jobs: push: origin HEAD:main aur: - runs-on: archlinux + needs: gnu-bash + runs-on: ubuntu-latest + container: + image: archlinux:latest steps: - - uses: actions/checkout@master + - name: Install base-devel + run: | + pacman -Syu --noconfirm base-devel wget bc - name: Get release information run: | - RELEASE_TAG=${{ github.event.release.tag_name }} + RELEASE_TAG=$(echo ${{ github.event.release.tag_name }} | sed "s|v||") echo "Release tag: $RELEASE_TAG" echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV - name: Use release information run: | echo "Using release tag: $RELEASE_TAG" + - name: Setup environment + run: | + echo "PKGVER=${{ env.RELEASE_TAG }}" >> $GITHUB_ENV + echo "PKGREL=$(echo "1+$(curl "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=gpt-cli" | head -n 3 | tail -n 1 | cut -d "=" -f 2)" | bc)" >> $GITHUB_ENV + - run: echo ${{ env.PKGVER }} + - name: Setup environment2 + run: | + wget "https://github.com/gustawdaniel/gpt-cli/releases/download/v${{ env.PKGVER }}/gpt-cli.gnu" -O gpt-cli.gnu + echo "CHECKSUM=$(sha512sum gpt-cli.gnu | cut -d " " -f 1)" >> $GITHUB_ENV + + - name: Prepare PKGBUILD + run: | + cat <> PKGBUILD + pkgname=gpt-cli + pkgver=${{ env.PKGVER }} + pkgrel=${{ env.PKGREL }} + pkgdesc="Run linux commands with natural language. Eg 'show my graphic card' instead 'lspci | grep VGA'" + arch=('x86_64') + url="https://github.com/gustawdaniel/gpt-cli" + license=('MIT') + depends=('xorg-server-devel' 'libxcb') + options=() + source_x86_64=("https://github.com/gustawdaniel/gpt-cli/releases/download/v${{ env.PKGVER }}/gpt-cli.gnu") + sha512sums_x86_64=('${{ env.CHECKSUM }}') + + package() { + # Install the binary + install -Dm755 "\$srcdir/gpt-cli" "\$pkgdir/usr/bin/gpt-cli" + + # Create a symbolic link + ln -s "/usr/bin/gpt-cli" "\$pkgdir/usr/bin/p" + } + EOT + + - name: Generate .SRCINFO + run: | + useradd -m builduser + passwd -d builduser + echo "builduser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/builduser + chown -R builduser:builduser . + sudo -u builduser bash -c "makepkg --printsrcinfo > .SRCINFO" + + - name: Show files + run: | + ls -la + cat PKGBUILD + cat .SRCINFO + + - name: Publish AUR package + uses: KSXGitHub/github-actions-deploy-aur@v2.7.0 + with: + pkgname: gpt-cli + pkgbuild: ./PKGBUILD + commit_username: gustawdaniel + commit_email: gustaw.daniel@gmail.com + ssh_private_key: ${{ secrets.ID_ED25519 }} + commit_message: Release ${{ env.PKGVER }}-${{ env.PKGREL }} + ssh_keyscan_types: ed25519 musl-docker: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 08a4e00..518e43a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ name: Test on: push: branches-ignore: - - 'main' # Exclude main branch if needed + - '' # Exclude main branch if needed tags-ignore: - '' # Exclude annotated tags if needed pull_request: diff --git a/Cargo.lock b/Cargo.lock index 6441dfc..28509d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1128,7 +1128,7 @@ dependencies = [ [[package]] name = "gpt-cli" -version = "0.0.14" +version = "0.0.15" dependencies = [ "async-recursion", "colored", diff --git a/Cargo.toml b/Cargo.toml index 81355a0..6bf8826 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gpt-cli" -version = "0.0.14" +version = "0.0.15" edition = "2021" authors = ["Daniel Gustaw "] license = "MIT"