Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Automate AUR Publishing #3107

Merged
merged 7 commits into from
Oct 31, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/release_aur.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Update AUR

on:
release:
types: [published]

jobs:
update-aur:
runs-on: ubuntu-latest

container:
image: archlinux

steps:
- name: Install Dependencies
run: |
pacman -Syu --noconfirm wget jq

- name: Download Package
run: |
set -x
latest_version=$(curl -s https://api.github.com/repos/Heroic-Games-Launcher/HeroicGamesLauncher/releases/latest | jq -r .tag_name)
version_without_v=$(echo $latest_version | cut -c 2-)
wget https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/download/${latest_version}/heroic-${version_without_v}.pacman -O heroic.pacman
set +x
if: ${{ success() }}

- name: Update PKGBUILD
run: |
set -x
latest_version=$(curl -s https://api.github.com/repos/Heroic-Games-Launcher/HeroicGamesLauncher/releases/latest | jq -r .tag_name)
pkgver=${latest_version#v}
pkgrel=1
url="https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher"
_filename=heroic-${pkgver}.pacman
source=("$url/releases/download/$latest_version/$_filename")
md5sums=($(md5sum heroic.pacman | cut -d' ' -f1))

cat <<EOF > PKGBUILD
# Maintainer: flaviofearn <[email protected]>

pkgname=heroic-games-launcher-bin
pkgver=$pkgver
pkgrel=$pkgrel
pkgdesc="An open source Web3 gaming platform."
flavioislima marked this conversation as resolved.
Show resolved Hide resolved
arch=('x86_64')
url="$url"
license=('GPL3')
depends=('gawk')
_filename=$_filename
source=("$source")
noextract=("$_filename")
md5sums=(${md5sums[@]})
options=(!strip)

package() {
tar -xJv -C "\$pkgdir" -f "\$srcdir/\$_filename" usr opt
mkdir "\$pkgdir/usr/bin"
ln -s "/opt/Heroic/heroic" "\$pkgdir/usr/bin/heroic"
}

# vim:set ts=2 sw=2 et: syntax=sh

EOF
cat PKGBUILD
set +x
if: ${{ success() }}

- name: Publish AUR package
uses: KSXGitHub/github-actions-deploy-aur@v2
with:
pkgname: heroic-games-launcher-bin
pkgbuild: ./PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE }}
commit_message: Update AUR package
ssh_keyscan_types: rsa,dsa,ecdsa,ed25519