Skip to content

Deskreen Release v2.0.4fix #1

Deskreen Release v2.0.4fix

Deskreen Release v2.0.4fix #1

# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release
on:
release:
types: [released]
name: Update Homebrew cask
jobs:
homebrew-pr:
runs-on: macos-10.15
steps:
- name: Set $VERSION without preifx v
# https://github.community/t/how-to-get-just-the-tag-name/16241
# https://stackoverflow.com/questions/57968497/how-do-i-set-an-env-var-with-a-bash-expression-in-github-actions
run: echo VERSION=$(echo ${GITHUB_REF##*/} | cut -c2-) >> $GITHUB_ENV
- name: Install Homebrew
# Command from https://brew.sh/
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#updating-a-cask
- name: Updating cask Deskreen
run: brew bump-cask-pr --version $VERSION deskreen
env:
# First, create a personal access token: (url from Homebrew's output)
# https://github.com/settings/tokens/new?scopes=gist,public_repo,workflow&description=Homebrew
# Then, go repo settings -> Secrets -> New repository secret -> HOMEBREW_GITHUB_API_TOKEN : <secret value>.
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
update-aur:
runs-on: ubuntu-latest
env:
AUR_PRIVATE_KEY: ${{ secrets.AUR_PRIVATE_KEY }}
AUR_EMAIL: ${{ secrets.AUR_EMAIL }}
AUR_NAME: ${{ secrets.AUR_NAME }}
container: archlinux
steps:
- name: Update package database and packages
run: |
set -e -x
export VERSION=$(echo ${GITHUB_REF##*/} | cut -c2-)
(patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst && curl -LO "https://repo.archlinuxcn.org/x86_64/$patched_glibc" && bsdtar -C / -xvf "$patched_glibc") &> /dev/null
pacman --noconfirm -Syu
pacman --noconfirm -S base-devel wget git openssh
- name: Setup keys for git
run: |
mkdir -p ~/.ssh
echo "$AUR_PRIVATE_KEY" > ~/.ssh/aur
chmod 400 ~/.ssh/aur
echo "
Host aur.archlinux.org
IdentityFile ~/.ssh/aur
User aur" >> ~/.ssh/config
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
- name: Clone the repository
run: |
if [ -d deskreen-aur ]
then
rm -rf deskreen-aur
fi
git clone ssh://[email protected]/deskreen.git deskreen-aur
- name: Update version and set variables
run: |
cd deskreen-aur
sed -i "/pkgver=/c\pkgver=$VERSION" PKGBUILD
_pkgname=Deskreen
pkgname=deskreen
pkgver=$VERSION
- name: Download the AppImage and set sha256sum
run: |
wget -nv https://github.com/pavlobu/${pkgname}/releases/download/v${pkgver//_/-}/${_pkgname}-${pkgver}.AppImage
arr=(`sha256sum *.AppImage`)
echo "$arr"
sed -i "20s/.*/ '$arr' /" PKGBUILD
- name: Download makepkg
run: |
# own version of makepkg without needed root
curl -L https://bit.ly/3jBbJDx > makepkg
chmod +x makepkg
./makepkg --printsrcinfo > .SRCINFO
- name: Push to git
run: |
git add .
git config user.name "$AUR_NAME"
git config user.email "$AUR_EMAIL"
git commit -m "updated pkgbuild to $VERSION"
git push
- name: Remove key
run: |
rm -fv ~/.ssh/aur