-
Notifications
You must be signed in to change notification settings - Fork 3
83 lines (72 loc) · 2.88 KB
/
NuGet-Checker.yml
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
75
76
77
78
79
80
81
82
83
name: NuGet Checker
on:
schedule:
- cron: 0 0/12 * * *
workflow_dispatch:
jobs:
NuGet-Checker:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
path: main
- name: Check if branch exist
working-directory: main
run: |
if [ "$(git ls-remote --heads origin update-nuget)" != "" ]; then
echo "::warning ::Branch update-nuget exist. Merge PR or delete the branch"
exit 1
fi
- name: Flatpak Cache
uses: actions/cache@v4
with:
path: |
~/.local/share/flatpak
key: flatpak-cache-x86_64-${{ github.sha }}
restore-keys: |
flatpak
- name: Setup Dependencies
run: |
sudo apt update -y
sudo apt install flatpak -y
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo su $(whoami) -c 'flatpak install flathub org.flatpak.Builder -y'
mkdir -p ~/.local/bin
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O ~/.local/bin/yq
chmod +x ~/.local/bin/yq
- name: Set ENV Variables
run: |
echo "RUNTIME-VERSIONFROMYAML=$(yq '.runtime-version' main/org.jellyfin.JellyfinServer.yml)" >> "$GITHUB_ENV"
echo "DOTNETSDKFROMYAML=$(yq '.sdk-extensions[0]' main/org.jellyfin.JellyfinServer.yml)" >> "$GITHUB_ENV"
echo "TAGFROMYAML=$(yq '.modules[-1].sources[2].tag' main/org.jellyfin.JellyfinServer.yml)" >> "$GITHUB_ENV"
- name: Checkout Jellyfin
uses: actions/checkout@v4
with:
repository: jellyfin/jellyfin
path: jellyfin
ref: ${{ env.TAGFROMYAML }}
- name: Checkout Flatpak Builder Tools
uses: actions/checkout@v4
with:
repository: flatpak/flatpak-builder-tools
path: flatpak-builder-tools
- name: Generate cache for NuGet
run: |
sudo su $(whoami) -c 'flatpak update -y'
sudo su $(whoami) -c 'flatpak install flathub org.freedesktop.Sdk//${{ env.RUNTIME-VERSIONFROMYAML }} -y'
sudo su $(whoami) -c 'flatpak install flathub ${{ env.DOTNETSDKFROMYAML }}//${{ env.RUNTIME-VERSIONFROMYAML }} -y'
./flatpak-builder-tools/dotnet/flatpak-dotnet-generator.py \
--runtime=linux-x64 main/nuget-generated-sources-x64.json jellyfin/Jellyfin.Server/Jellyfin.Server.csproj
./flatpak-builder-tools/dotnet/flatpak-dotnet-generator.py \
--runtime=linux-arm64 main/nuget-generated-sources-arm64.json jellyfin/Jellyfin.Server/Jellyfin.Server.csproj
- name: Create Pull Request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
path: main
title: Update NuGet Cache
commit-message: Update NuGet Cache
branch: update-nuget
delete-branch: true