💚 Set builddir #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release-plz | |
permissions: | |
pull-requests: write | |
contents: write | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release-plz: | |
name: Release-plz | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Run release-plz | |
uses: MarcoIeni/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
publish-aur: | |
needs: release-plz | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux:base-devel | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install git and gnupg | |
run: pacman -Syu --noconfirm git gnupg openssh | |
- name: Update PKGBUILD | |
run: | | |
version=$(grep '^version =' Cargo.toml | sed 's/.*= "\(.*\)"/\1/') | |
sed "s/pkgver=.*/pkgver=$version/" PKGBUILD.template > PKGBUILD | |
sum=$(curl -sL "https://crates.io/api/v1/crates/image-colorizer/$version/download" | sha256sum | cut -d ' ' -f 1) | |
sed -i "s/sha256sums=('PLACEHOLDER')/sha256sums=('$sum')/" PKGBUILD | |
- name: Generate .SRCINFO | |
run: | | |
mkdir /home/build | |
chgrp nobody /home/build | |
chmod g+ws /home/build | |
setfacl -m u::rwx,g::rwx /home/build | |
setfacl -d --set u::rwx,g::rwx,o::- /home/build | |
BUILDDIR = /home/build runuser -unobody makepkg -- --printsrcinfo > .SRCINFO | |
- name: Import GPG key | |
env: | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
run: | | |
echo "$GPG_PRIVATE_KEY" | gpg --batch --import | |
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf | |
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf | |
gpg-connect-agent reloadagent /bye | |
- name: Publish to AUR | |
env: | |
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
run: | | |
mkdir -p ~/.ssh | |
echo "$AUR_SSH_PRIVATE_KEY" > ~/.ssh/aur | |
chmod 600 ~/.ssh/aur | |
eval $(ssh-agent -s) | |
ssh-add ~/.ssh/aur | |
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts | |
git config --global user.name "Taylor Beeston" | |
git config --global user.email "[email protected]" | |
git config --global user.signingkey $(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2) | |
git config --global commit.gpgsign true | |
git clone ssh://[email protected]/image-colorizer.git aur-repo | |
cp PKGBUILD .SRCINFO aur-repo/ | |
cd aur-repo | |
git add PKGBUILD .SRCINFO | |
echo $GPG_PASSPHRASE | git commit -S -m "Update to version $(grep -oP '(?<=pkgver=)\S+' PKGBUILD)" | |
git push |