Skip to content

Commit

Permalink
push to pkg repo
Browse files Browse the repository at this point in the history
Signed-off-by: Omansh Krishn <[email protected]>

add dependency on prev. job

Signed-off-by: Omansh Krishn <[email protected]>

new logic for new release

Signed-off-by: Omansh Krishn <[email protected]>

repo-add is in pacman 🤦

Signed-off-by: Omansh Krishn <[email protected]>

add working dir to safe dir

Signed-off-by: Omansh Krishn <[email protected]>
  • Loading branch information
omansh-krishn committed Apr 9, 2024
1 parent 17ac9c4 commit 9e44f98
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .SRCINFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pkgbase = materialgram-bin
pkgdesc = What if Telegram and Google had kids - Static binaries
pkgver = v4.15.6.1
pkgdesc = What if Telegram and Google had kids - Binary Version
pkgver = v4.16.4.1
pkgrel = 1
url = https://github.com/kukuruzka165/materialgram
arch = x86_64
Expand All @@ -24,7 +24,7 @@ pkgbase = materialgram-bin
optdepends = xdg-desktop-portal: desktop integration
provides = materialgram
conflicts = materialgram
source = https://github.com/kukuruzka165/materialgram/releases/download/v4.15.6.1/materialgram-v4.15.6.1.tar.gz
sha256sums = b1f75c56184a5fb74058552b0ea24af8c4d038ddb50c42e63ac403b4f6661ead
source = https://github.com/kukuruzka165/materialgram/releases/download/v4.16.4.1/materialgram-v4.16.4.1.tar.gz
sha256sums = 1286e78575d13cdb65dbf85ccc40aec25666320372fe92799e6f323cc2afbf05

pkgname = materialgram-bin
57 changes: 45 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Build Package

on:
push:
branches:
- main
repository_dispatch:
types: [new-release, rebuild]

env:
PAT: ${{secrets.PAT}}
Expand All @@ -20,26 +19,60 @@ jobs:
pacman-key --init
pacman-key --populate archlinux
pacman -Syu --noconfirm --quiet
pacman -S base-devel git sudo github-cli --noconfirm --quiet
pacman -S base-devel git sudo github-cli pacman-contrib jq --noconfirm --quiet
- name: Build package
- name: Add a Build user
run: |
useradd -m builder
echo "builder ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers
su builder -c "git clone https://github.com/materialgram/materialgram-bin /home/builder/build && cd /home/builder/build && makepkg --syncdeps --noconfirm --needed && rm *debug*"
- name: Build PKG
run: |
su builder -c "git clone https://github.com/materialgram/materialgram-bin /home/builder/build && cd /home/builder/build \
&& sed -i "s/pkgver=.*/pkgver=${{ github.event.client_payload.tagname }}/" PKGBUILD \
&& sed -i "s/pkgrel=.*/pkgrel=${{ github.event.client_payload.pkgrel }}/" PKGBUILD \
&& updpkgsums && makepkg --syncdeps --noconfirm --needed && rm *debug*"
- name: Set filename as variable
run: echo "FILENAME=$(basename /home/builder/build/*.zst)" >> $GITHUB_ENV
- name: Set env variables
run: |
echo "FILENAME=$(basename /home/builder/build/*.zst)" >> $GITHUB_ENV
export TAG=$(curl -s https://api.github.com/repos/materialgram/materialgram-bin/releases/latest | jq -r '.tag_name')
echo "CURRENTTAG=$(echo $TAG)" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.FILENAME }}
path: /home/builder/build/*.zst
- name: UPLOAD TO GITHUB RELEASES

- name: Upload artifact to Release via gh-cli
run: |
echo $PAT | gh auth login --with-token
export VERSION=$(cat /home/builder/build/PKGBUILD | grep 'pkgver=' | cut -d'=' -f2)
gh release create ${VERSION} /home/builder/build/${{ env.FILENAME }} --repo materialgram/materialgram-bin --notes ${VERSION}
if [ "${{ env.CURRENTTAG }}" == "${{ github.event.client_payload.tagname }}-${{ github.event.client_payload.pkgrel }}" ]; then gh release delete ${{ env.CURRENTTAG }} --repo materialgram/materialgram-bin -y; fi
gh release create ${{ github.event.client_payload.tagname }}-${{ github.event.client_payload.pkgrel }} /home/builder/build/${{ env.FILENAME }} --repo materialgram/materialgram-bin --title ${{ github.event.client_payload.tagname }} --notes ${{ github.event.client_payload.tagname }}
update-pkg-repo:
runs-on: ubuntu-latest
container:
image: archlinux:latest

needs: build
steps:
- name: deps
run: pacman -Sy && pacman -S git jq wget --noconfirm
- name: Checkout repo
uses: actions/checkout@v4
with:
repository: materialgram/arch
token: ${{ secrets.PAT }}

- name: do the things
run: |
rm m*
TAG=$(curl -s https://api.github.com/repos/materialgram/materialgram-bin/releases/latest | jq -r '.tag_name')
BIN=$(curl -s https://api.github.com/repos/materialgram/materialgram-bin/releases/latest | jq -r '.assets[] | .name' | grep zst)
URL=https://github.com/materialgram/materialgram-bin/releases/download/${TAG}/${BIN}
wget $URL
repo-add materialgram.db.tar.gz *zst
git config --global --add safe.directory /__w/materialgram-bin/materialgram-bin && git config --global user.email "[email protected]" && git config --global user.name "Omansh Krishn" && git add . && git commit -s -m "materialgram: Update ${{ github.event.client_payload.tagname }}-${{ github.event.client_payload.pkgrel }}"
git push
6 changes: 3 additions & 3 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Maintainer: omansh-krishn <[email protected]>
# Contributor: westpain <[email protected]>
pkgname=materialgram-bin
pkgver=v4.15.6.1
pkgver=v4.16.4.1
pkgrel=1
pkgdesc="What if Telegram and Google had kids - Static binaries"
pkgdesc="What if Telegram and Google had kids - Binary Version"
arch=(x86_64)
url="https://github.com/kukuruzka165/materialgram"
license=(GPL3)
Expand All @@ -16,7 +16,7 @@ conflicts=('materialgram')

source=( https://github.com/kukuruzka165/materialgram/releases/download/${pkgver}/materialgram-${pkgver}.tar.gz )

sha256sums=('b1f75c56184a5fb74058552b0ea24af8c4d038ddb50c42e63ac403b4f6661ead')
sha256sums=('1286e78575d13cdb65dbf85ccc40aec25666320372fe92799e6f323cc2afbf05')

package() {

Expand Down

0 comments on commit 9e44f98

Please sign in to comment.