|
4 | 4 | push: |
5 | 5 | paths: |
6 | 6 | - PKGBUILD |
| 7 | + - PKGBUILD-git |
7 | 8 | - .github/workflows/xivlauncher.yml |
8 | 9 | pull_request: |
9 | 10 | branches: |
10 | 11 | - main |
11 | 12 | paths: |
12 | 13 | - PKGBUILD |
| 14 | + - PKGBUILD-git |
13 | 15 | workflow_dispatch: |
14 | 16 | inputs: |
15 | 17 | aur: |
|
20 | 22 |
|
21 | 23 | jobs: |
22 | 24 | build: |
| 25 | + strategy: |
| 26 | + matrix: |
| 27 | + variant: |
| 28 | + - xivlauncher |
| 29 | + - xivlauncher-git |
23 | 30 | runs-on: ubuntu-latest |
24 | | - container: ghcr.io/centzilius/arch-makepkg:latest |
| 31 | + container: archlinux:latest |
25 | 32 | steps: |
| 33 | + - name: Prepare container |
| 34 | + run: | |
| 35 | + echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf |
| 36 | + pacman-key --init |
| 37 | + pacman -Sy --noconfirm --needed archlinux-keyring |
| 38 | + pacman -Syu --noconfirm base-devel git rsync openssh |
| 39 | + useradd -m -s /bin/bash builder |
| 40 | + echo "builder ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/builder |
26 | 41 | - uses: actions/checkout@v6 |
| 42 | + - name: Use git PKGBUILD |
| 43 | + if: matrix.variant == 'xivlauncher-git' |
| 44 | + run: |
| 45 | + mv PKGBUILD{-git,} |
27 | 46 | - name: Prepare workspace |
28 | 47 | run: | |
29 | 48 | mkdir /home/builder/workspace |
30 | 49 | rsync -ahvP /__w/aur-xivlauncher/aur-xivlauncher/ /home/builder/workspace/ |
31 | 50 | chown -R builder:builder /home/builder/ |
32 | 51 | - name: Build package |
| 52 | + working-directory: /home/builder/workspace |
33 | 53 | run: | |
34 | | - cd /home/builder/workspace |
35 | 54 | sudo -u builder makepkg -scf --noconfirm |
| 55 | + sudo -u builder makepkg --printsrcinfo | tee .SRCINFO |
36 | 56 | - name: Rename artifact |
37 | | - run: | |
38 | | - cd /home/builder/workspace |
39 | | - mv *.pkg.tar.zst xivlauncher.pkg.tar.zst |
| 57 | + working-directory: /home/builder/workspace |
| 58 | + run: mv *.pkg.tar.zst ${{ matrix.variant }}.pkg.tar.zst |
40 | 59 | - name: Upload artifact |
41 | 60 | uses: actions/upload-artifact@v6 |
42 | 61 | with: |
43 | | - name: xivlauncher |
44 | | - path: /home/builder/workspace/*.pkg.tar.zst |
| 62 | + name: ${{ matrix.variant }} |
| 63 | + path: | |
| 64 | + /home/builder/workspace/*.pkg.tar.zst |
| 65 | + /home/builder/workspace/.SRCINFO |
45 | 66 | if-no-files-found: error |
| 67 | + include-hidden-files: true |
46 | 68 | aur: |
47 | 69 | needs: build |
| 70 | + strategy: |
| 71 | + matrix: |
| 72 | + variant: |
| 73 | + - xivlauncher |
| 74 | + - xivlauncher-git |
48 | 75 | if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event.inputs.aur == 'true' }} |
49 | 76 | runs-on: ubuntu-latest |
50 | | - container: ghcr.io/centzilius/arch-makepkg:latest |
51 | 77 | steps: |
52 | 78 | - name: Checkout repo |
53 | 79 | uses: actions/checkout@v6 |
| 80 | + with: |
| 81 | + path: 'github' |
| 82 | + - name: Use git PKGBUILD |
| 83 | + if: matrix.variant == 'xivlauncher-git' |
| 84 | + working-directory: "${{ github.workspace }}/github" |
| 85 | + run: |
| 86 | + mv PKGBUILD{-git,} |
| 87 | + - name: Prepare SSH |
| 88 | + run: | |
| 89 | + mkdir -p "$HOME"/.ssh |
| 90 | + chmod 700 "$HOME"/.ssh |
| 91 | + ssh-keyscan aur.archlinux.org >> "$HOME"/.ssh/known_hosts |
| 92 | + echo "${{ secrets.ssh_key }}" > "$HOME"/.ssh/id_ed25519 |
| 93 | + chmod 400 "$HOME"/.ssh/* |
| 94 | + ssh-keygen -y -f "$HOME"/.ssh/id_ed25519 > "$HOME"/.ssh/id_ed25519.pub |
54 | 95 | - name: Checkout AUR |
55 | 96 | run: | |
56 | | - cd /root |
57 | | - mkdir -p .ssh |
58 | | - chmod 700 .ssh |
59 | | - ssh-keyscan aur.archlinux.org >> /root/.ssh/known_hosts |
60 | | - echo "${{ secrets.ssh_key }}" > /root/.ssh/id_ed25519 |
61 | | - chmod 400 /root/.ssh/* |
62 | | - ssh-keygen -y -f /root/.ssh/id_ed25519 > /root/.ssh/id_ed25519.pub |
63 | | - cd /tmp |
64 | | - git clone ssh://aur@aur.archlinux.org/xivlauncher.git aur |
| 97 | + git clone ssh://aur@aur.archlinux.org/${{ matrix.variant }}.git "$GITHUB_WORKSPACE"/aur |
| 98 | + - name: Download (.SRCINFO) artifact |
| 99 | + uses: actions/download-artifact@v8 |
| 100 | + with: |
| 101 | + name: ${{ matrix.variant }} |
65 | 102 | - name: Copy files |
66 | 103 | run: | |
67 | | - rsync -ahvP $GITHUB_WORKSPACE/{PKGBUILD,XIVLauncher.desktop,xivlauncher-core} /tmp/aur/ |
68 | | - - name: Generate .SRCINFO |
| 104 | + rsync -ahvP "$GITHUB_WORKSPACE"/github/{PKGBUILD,XIVLauncher.desktop,xivlauncher-core} "$GITHUB_WORKSPACE"/aur/ |
| 105 | + rsync -ahvP "$GITHUB_WORKSPACE"/.SRCINFO "$GITHUB_WORKSPACE"/aur/.SRCINFO |
| 106 | + - name: Check git status |
| 107 | + id: gitstatus |
| 108 | + working-directory: "${{ github.workspace }}/aur" |
69 | 109 | run: | |
70 | | - chown -R builder:builder /tmp/aur/ |
71 | | - cd /tmp/aur/ |
72 | | - sudo -u builder makepkg --printsrcinfo | tee .SRCINFO |
73 | | - chown -R root:root /tmp/aur/ |
| 110 | + test -z "$(git status --porcelain)" && echo "clean=1" >> "$GITHUB_OUTPUT" || echo "clean=0" >> "$GITHUB_OUTPUT" |
74 | 111 | - name: Push |
| 112 | + if: success() && steps.gitstatus.outputs.clean == '0' |
| 113 | + working-directory: "${{ github.workspace }}/aur" |
75 | 114 | run: | |
76 | | - cd /tmp/aur/ |
77 | 115 | git config user.email "cent@spline.de" |
78 | 116 | git config user.name "cent" |
79 | 117 | git add --all |
80 | 118 | git commit -m 'sync from github' |
81 | 119 | git push -u origin master |
82 | 120 | - name: Cleanup SSH |
83 | 121 | if: always() |
84 | | - run: rm -rf /root/.ssh |
| 122 | + run: rm -rf "$HOME"/.ssh |
0 commit comments