-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (65 loc) · 2.6 KB
/
Copy pathsync-aur.yml
File metadata and controls
74 lines (65 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Sync AUR
on:
push:
branches:
- main
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Release version (without v), for example 0.1.0"
required: true
jobs:
sync:
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install build tooling
run: pacman -Syu --noconfirm --needed base-devel git openssh curl python
- name: Mark workspace as safe
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Resolve version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
SOURCE_ARCHIVE_PATH="refs/tags/v${VERSION}"
SRC_DIRNAME="FarmMod-${VERSION}"
elif [ "${GITHUB_REF_TYPE}" = "tag" ]; then
VERSION="${GITHUB_REF_NAME#v}"
SOURCE_ARCHIVE_PATH="refs/tags/${GITHUB_REF_NAME}"
SRC_DIRNAME="FarmMod-${VERSION}"
else
VERSION="$(python -c 'import pathlib, tomllib; print(tomllib.loads(pathlib.Path("pyproject.toml").read_text(encoding="utf-8"))["project"]["version"])')"
SOURCE_ARCHIVE_PATH="refs/heads/main"
SRC_DIRNAME="FarmMod-main"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "source_archive_path=${SOURCE_ARCHIVE_PATH}" >> "$GITHUB_OUTPUT"
echo "src_dirname=${SRC_DIRNAME}" >> "$GITHUB_OUTPUT"
- name: Configure SSH
run: |
install -d -m 700 ~/.ssh
echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
- name: Sync AUR package
env:
VERSION: ${{ steps.version.outputs.version }}
SOURCE_ARCHIVE_PATH: ${{ steps.version.outputs.source_archive_path }}
SRC_DIRNAME: ${{ steps.version.outputs.src_dirname }}
UPSTREAM_REPO: ${{ github.repository }}
AUR_PACKAGE: farmmod
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_SSH_COMMAND: ssh -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new
run: ./scripts/sync_aur_release.sh