Skip to content

new-release

new-release #49

Workflow file for this run

name: Build Package
on:
repository_dispatch:
types: [new-release, rebuild]
env:
PAT: ${{secrets.PAT}}
jobs:
build:
runs-on: ubuntu-latest
container:
image: archlinux/archlinux:latest
steps:
- name: Update system and install dependencies
run: |
pacman-key --init
pacman-key --populate archlinux
pacman -Sy base-devel git sudo github-cli pacman-contrib jq --noconfirm --quiet
pacman -Syu --noconfirm
pacman -Scc --noconfirm
- name: Add a Build user
run: |
useradd -m builder
echo "builder ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers
- 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 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 artifact to Release via gh-cli
run: |
echo $PAT | gh auth login --with-token
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/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
update-source-repo:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
repository: materialgram/materialgram
token: ${{ secrets.PAT }}
- name: Fetch and Update
run: |
git remote add upstream https://github.com/kukuruzka165/materialgram && git pull upstream main
git branch -m old && git checkout --track upstream/main && git push origin main -f