mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-04-17 08:06:52 -04:00
183 lines
7.4 KiB
YAML
183 lines
7.4 KiB
YAML
name: Build Arch package
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version'
|
|
required: false
|
|
create-pr:
|
|
description: 'Create a PR for AUR mirror'
|
|
type: boolean
|
|
default: false
|
|
push:
|
|
branches-ignore:
|
|
- 'dependabot/**'
|
|
paths:
|
|
- '.github/workflows/linux-makepkg.yml'
|
|
- 'dist/linux/makepkg/**'
|
|
- 'dist/linux/common/**'
|
|
- 'dist/linux/resources/**'
|
|
|
|
jobs:
|
|
get-version:
|
|
uses: ./.github/workflows/get-version.yml
|
|
with:
|
|
version: ${{ inputs.version }}
|
|
|
|
makepkg:
|
|
name: Build with makepkg
|
|
needs: [get-version]
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: archlinux:base-devel
|
|
env:
|
|
PKGDEST: ${{ github.workspace }}/pkgdest
|
|
SRCDEST: ${{ github.workspace }}/srcdest
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- name: Prepare pacman
|
|
run: |
|
|
pacman-key --init
|
|
pacman-key --populate archlinux
|
|
pacman -Syu --noconfirm --needed git base-devel sudo gnupg maven unzip
|
|
- name: Create build user
|
|
run: |
|
|
useradd -m builder
|
|
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/builder
|
|
chown -R builder:builder "$GITHUB_WORKSPACE"
|
|
install -d -m 0755 -o builder -g builder "$PKGDEST" "$SRCDEST"
|
|
- name: Set package version
|
|
run: |
|
|
sed -i -e 's|^pkgver=.*$|pkgver=${{ needs.get-version.outputs.semVerStr }}|' dist/linux/makepkg/PKGBUILD
|
|
- name: Build package with makepkg
|
|
working-directory: dist/linux/makepkg
|
|
run: |
|
|
sudo -u builder env \
|
|
PKGDEST="$PKGDEST" \
|
|
SRCDEST="$SRCDEST" \
|
|
makepkg --syncdeps --cleanbuild --noconfirm --log
|
|
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
with:
|
|
name: arch-package-${{ github.run_number }}
|
|
if-no-files-found: error
|
|
path: |
|
|
${{ env.PKGDEST }}/*.pkg.tar.zst
|
|
|
|
create-pr:
|
|
name: Create PR for AUR
|
|
if: github.event_name == 'workflow_dispatch' && inputs.create-pr || needs.get-version.outputs.versionType == 'stable'
|
|
runs-on: ubuntu-latest
|
|
needs: [get-version, makepkg]
|
|
container:
|
|
image: archlinux:base-devel
|
|
env:
|
|
PKGDEST: ${{ github.workspace }}/pkgdest
|
|
SRCDEST: ${{ github.workspace }}/srcdest
|
|
steps:
|
|
- name: Prepare pacman
|
|
run: |
|
|
pacman-key --init
|
|
pacman-key --populate archlinux
|
|
pacman -Syu --noconfirm --needed git base-devel sudo gnupg maven unzip github-cli
|
|
- name: Download source tarball and compute checksum
|
|
id: sha256
|
|
run: |
|
|
URL="https://github.com/cryptomator/cryptomator/archive/refs/tags/${TAG}.tar.gz"
|
|
curl --silent --fail-with-body -L -H "Accept: application/vnd.github+json" ${URL} --output cryptomator.tar.gz
|
|
TARBALL_SHA256=$(sha256sum cryptomator.tar.gz | cut -d ' ' -f1)
|
|
echo "value=${TARBALL_SHA256}" >> "$GITHUB_OUTPUT"
|
|
env:
|
|
TAG: ${{ needs.get-version.outputs.semVerNum || github.event.release.tag_name }}
|
|
- name: Checkout cryptomator/aur repo
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
repository: 'cryptomator/aur'
|
|
token: ${{ secrets.CRYPTOBOT_PR_TOKEN }}
|
|
- name: Create build user
|
|
run: |
|
|
useradd -m builder
|
|
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/builder
|
|
chown -R builder:builder "$GITHUB_WORKSPACE"
|
|
install -d -m 0755 -o builder -g builder "$PKGDEST" "$SRCDEST"
|
|
- name: Import Cryptomator release signing key
|
|
# try first ubuntu. on failure try openpgp keyservers
|
|
run: |
|
|
sudo -u builder gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 58117AFA1F85B3EEC154677D615D449FE6E6A235 || \
|
|
sudo -u builder gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys 58117AFA1F85B3EEC154677D615D449FE6E6A235
|
|
- name: Checkout release branch
|
|
run: |
|
|
git checkout -b release/${BRANCHNAME}
|
|
env:
|
|
BRANCH_NAME: ${{ needs.get-version.outputs.semVerStr }}
|
|
- name: Determine pkgrel
|
|
id: pkgrel
|
|
run: |
|
|
TARGET_VERSION='${{ needs.get-version.outputs.semVerStr }}'
|
|
CURRENT_VERSION="$(sed -nE 's/^pkgver=(.*)$/\1/p' PKGBUILD | head -n1)"
|
|
CURRENT_REL="$(sed -nE 's/^pkgrel=([0-9]+).*$/\1/p' PKGBUILD | head -n1)"
|
|
|
|
if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" && "$CURRENT_REL" =~ ^[0-9]+$ ]]; then
|
|
NEXT_REL=$((CURRENT_REL + 1))
|
|
else
|
|
NEXT_REL=1
|
|
fi
|
|
|
|
echo "value=${NEXT_REL}" >> "$GITHUB_OUTPUT"
|
|
- name: Update build file
|
|
run: |
|
|
sed -i -e "s|^pkgver=.*$|pkgver=$SEM_VERSION|" PKGBUILD
|
|
sed -i -e "s|^pkgrel=.*$|pkgrel=$PKG_REL|" PKGBUILD
|
|
sed -i -e "s|^source=.*$|$TAR_SOURCE|" PKGBUILD
|
|
sed -i -e "s|^sha256sums=.*$|$TAR_SHA|" PKGBUILD
|
|
sudo -u builder makepkg --printsrcinfo > .SRCINFO
|
|
env:
|
|
SEM_VERSION: ${{ needs.get-version.outputs.semVerStr }}
|
|
PKG_REL: ${{ steps.pkgrel.outputs.value }}
|
|
TAR_SOURCE: |-
|
|
source=("cryptomator-${pkgver//_/-}.tar.gz::https://github.com/cryptomator/cryptomator/archive/refs/tags/${pkgver//_/-}.tar.gz"
|
|
"cryptomator-${pkgver//_/-}.tar.gz.asc::https://github.com/cryptomator/cryptomator/releases/download/${pkgver//_/-}/cryptomator-${pkgver//_/-}.tar.gz.asc")
|
|
TAR_SHA: |-
|
|
sha256sums=('${{steps.sha256.outputs.value}}'
|
|
'SKIP')
|
|
- name: Build package with makepkg
|
|
run: |
|
|
sudo -u builder env \
|
|
PKGDEST="$PKGDEST" \
|
|
SRCDEST="$SRCDEST" \
|
|
makepkg --syncdeps --cleanbuild --noconfirm --log
|
|
- name: Commit and push
|
|
run: |
|
|
git config user.name "cryptobot"
|
|
git config user.email "automation@cryptomator.org"
|
|
git config push.autoSetupRemote true
|
|
git stage .
|
|
git commit -m "Prepare release ${VERSION}"
|
|
git push
|
|
env:
|
|
VERSION: ${{ needs.get-version.outputs.semVerStr }}-${{ steps.pkgrel.outputs.value }}
|
|
- name: Create pull request
|
|
id: create-pr
|
|
run: |
|
|
printf "> [!IMPORTANT]\n> Todos:\n> - [ ] Update build instructions\n> - [ ] Check for JDK update\n> - [ ] Check for JFX update" > pr_body.md
|
|
PR_URL=$(gh pr create --title "Release $VERSION" --body-file pr_body.md)
|
|
echo "url=$PR_URL" >> "$GITHUB_OUTPUT"
|
|
env:
|
|
VERSION: ${{ needs.get-version.outputs.semVerStr }}-${{ steps.pkgrel.outputs.value }}
|
|
GH_TOKEN: ${{ secrets.CRYPTOBOT_PR_TOKEN }}
|
|
- name: Slack Notification
|
|
if: github.event_name == 'release'
|
|
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2.3.3
|
|
env:
|
|
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CRYPTOMATOR_DESKTOP }}
|
|
SLACK_USERNAME: 'Cryptobot'
|
|
SLACK_ICON: false
|
|
SLACK_ICON_EMOJI: ':bot:'
|
|
SLACK_CHANNEL: 'cryptomator-desktop'
|
|
SLACK_TITLE: "AUR release PR created for ${{ github.event.repository.name }} ${{ github.event.release.tag_name }} created."
|
|
SLACK_MESSAGE: "See <${{ steps.create-pr.outputs.url }}|PR> on how to proceed."
|
|
SLACK_FOOTER: false
|
|
MSG_MINIMAL: true
|