aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release-build.yaml
blob: 1b4599f92472e9c1f37d174d1e8d723366f92776 (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: "Release Build"

on:
  workflow_dispatch:
    inputs:
      version:
        required: true
        type: string
        description: 'The server and web release tag ("vX.Y.Z") or "master"'

permissions:
  contents: read

jobs:
  Debian:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        release:
          - bullseye
          - bookworm
        arch:
          - amd64
          - arm64
          - armhf
    continue-on-error: false  # true in prod, false for testing
    steps:
      - name: "Set dated version for unstable builds"
        id: version
        run: |-
          if [[ ${{ inputs.version }} == "master" ]]; then
            echo "JELLYFIN_VERSION=$(date +'%Y%m%d%H')" >> $GITHUB_ENV
          else
            echo "JELLYFIN_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
          fi

      - name: "Install dependencies"
        run: |-
          sudo apt-get install --yes python3-git

      - name: "Checkout repository"
        uses: actions/checkout@v3

      - name: "Prepare repository"
        run: |-
          ./checkout.py ${{ inputs.version }}

      - name: "Run builder for ${{ matrix.version }} ${{ matrix.arch }}"
        run: |-
          sudo ./build.py ${{ env.JELLYFIN_VERSION }} debian ${{ matrix.arch }} ${{ matrix.release }}

      - name: "Upload artifacts to repository server"
        uses: appleboy/scp-action@v0.1.7
        with:
          host: "${{ secrets.REPO_HOST }}"
          username: "${{ secrets.REPO_USER }}"
          key: "${{ secrets.REPO_KEY }}"
          source: "out/debian/*"
          strip_components: 2
          target: "/srv/incoming/${{ env.JELLYFIN_VERSION }}/debian/${{ matrix.arch }}/${{ matrix.release }}"

      - name: "Import artifacts into reprepro"
        uses: appleboy/ssh-action@v1.0.3
        with:
          host: "${{ secrets.REPO_HOST }}"
          username: "${{ secrets.REPO_USER }}"
          key: "${{ secrets.REPO_KEY }}"
          debug: false
          script_stop: true
          script: |
            set -o xtrace
            echo ${{ env.JELLYFIN_VERSION }}
            if [[ ${{ inputs.version }} != "master" ]]; then
                COMPONENT="main"
            else
                COMPONENT="unstable"
            fi
            # Only include the architecture-dependent deb here, as the others are done only for amd64
            flock /run/lock/github-reprepro-debian.lock sudo reprepro --basedir /srv/debian --component ${COMPONENT} includedeb ${{ matrix.release }} /srv/incoming/${{ env.JELLYFIN_VERSION }}/debian/${{ matrix.arch }}/${{ matrix.release }}/*_${{ matrix.arch }}.deb
            if [[ ${{ matrix.arch }} == "amd64" ]]; then
                # Only include the architecture-independent packages for amd64; the other architectures are the same and conflict
                flock /run/lock/github-reprepro-debian.lock sudo reprepro --basedir /srv/debian --component ${COMPONENT} includedeb ${{ matrix.release }} /srv/incoming/${{ env.JELLYFIN_VERSION }}/debian/${{ matrix.arch }}/${{ matrix.release }}/*_all.deb
                # Only include the source DSC for amd64; the other architectures are the same and conflict
                flock /run/lock/github-reprepro-debian.lock sudo reprepro --basedir /srv/debian --component ${COMPONENT} includedsc ${{ matrix.release }} /srv/incoming/${{ env.JELLYFIN_VERSION }}/debian/${{ matrix.arch }}/${{ matrix.release }}/*.dsc
            fi

      - name: "Move artifacts into repository"
        uses: appleboy/ssh-action@v1.0.3
        with:
          host: "${{ secrets.REPO_HOST }}"
          username: "${{ secrets.REPO_USER }}"
          key: "${{ secrets.REPO_KEY }}"
          debug: false
          script_stop: true
          script: |
            sudo mkdir -p /srv/repository/mirror/releases/server/debian/versions/${{ env.JELLYFIN_VERSION }}/${{ matrix.arch }}
            sudo mv -t /srv/repository/mirror/releases/server/debian/versions/${{ env.JELLYFIN_VERSION }}/${{ matrix.arch }}/ /srv/incoming/${{ env.JELLYFIN_VERSION }}/debian/${{ matrix.arch }}/${{ matrix.release }}/*
            if [[ ${{ inputs.version }} != "master" ]]; then
                sudo ln -s /srv/repository/mirror/releases/server/debian/versions/${{ env.JELLYFIN_VERSION }}/${{ matrix.arch }} /srv/repository/mirror/releases/server/debian/latest-server
            fi

  Ubuntu:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        release:
          - focal
          - jammy
        # - noble
        arch:
          - amd64
          - arm64
          - armhf
    continue-on-error: false  # true in prod, false for testing
    steps:
      - name: "Set dated version for unstable builds"
        id: version
        run: |-
          if [[ ${{ inputs.version }} == "master" ]]; then
            echo "JELLYFIN_VERSION=$(date +'%Y%m%d%H')" >> $GITHUB_ENV
          else
            echo "JELLYFIN_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
          fi

      - name: "Install dependencies"
        run: |-
          sudo apt-get install --yes python3-git

      - name: "Checkout repository"
        uses: actions/checkout@v3

      - name: "Prepare repository"
        run: |-
          ./checkout.py ${{ inputs.version }}

      - name: "Run builder for ${{ matrix.version }} ${{ matrix.arch }}"
        run: |-
          sudo ./build.py ${{ env.JELLYFIN_VERSION }} ubuntu ${{ matrix.arch }} ${{ matrix.release }}

      - name: "Upload artifacts to repository server"
        uses: appleboy/scp-action@v0.1.7
        with:
          host: "${{ secrets.REPO_HOST }}"
          username: "${{ secrets.REPO_USER }}"
          key: "${{ secrets.REPO_KEY }}"
          source: "out/ubuntu/*"
          strip_components: 2
          target: "/srv/incoming/${{ env.JELLYFIN_VERSION }}/ubuntu/${{ matrix.arch }}/${{ matrix.release }}"

      - name: "Import artifacts into reprepro"
        uses: appleboy/ssh-action@v1.0.3
        with:
          host: "${{ secrets.REPO_HOST }}"
          username: "${{ secrets.REPO_USER }}"
          key: "${{ secrets.REPO_KEY }}"
          debug: false
          script_stop: true
          script: |
            set -o xtrace
            echo ${{ env.JELLYFIN_VERSION }}
            if [[ ${{ inputs.version }} != "master" ]]; then
                COMPONENT="main"
            else
                COMPONENT="unstable"
            fi
            # Only include the architecture-dependent deb here, as the others are done only for amd64
            flock /run/lock/github-reprepro-ubuntu.lock sudo reprepro --basedir /srv/ubuntu --component ${COMPONENT} includedeb ${{ matrix.release }} /srv/incoming/${{ env.JELLYFIN_VERSION }}/ubuntu/${{ matrix.arch }}/${{ matrix.release }}/*_${{ matrix.arch }}.deb
            if [[ ${{ matrix.arch }} == "amd64" ]]; then
                # Only include the architecture-independent packages for amd64; the other architectures are the same and conflict
                flock /run/lock/github-reprepro-ubuntu.lock sudo reprepro --basedir /srv/ubuntu --component ${COMPONENT} includedeb ${{ matrix.release }} /srv/incoming/${{ env.JELLYFIN_VERSION }}/ubuntu/${{ matrix.arch }}/${{ matrix.release }}/*_all.deb
                # Only include the source DSC for amd64; the other architectures are the same and conflict
                flock /run/lock/github-reprepro-ubuntu.lock sudo reprepro --basedir /srv/ubuntu --component ${COMPONENT} includedsc ${{ matrix.release }} /srv/incoming/${{ env.JELLYFIN_VERSION }}/ubuntu/${{ matrix.arch }}/${{ matrix.release }}/*.dsc
            fi

      - name: "Move artifacts into repository"
        uses: appleboy/ssh-action@v1.0.3
        with:
          host: "${{ secrets.REPO_HOST }}"
          username: "${{ secrets.REPO_USER }}"
          key: "${{ secrets.REPO_KEY }}"
          debug: false
          script_stop: true
          script: |
            sudo mkdir -p /srv/repository/mirror/releases/server/ubuntu/versions/${{ env.JELLYFIN_VERSION }}/${{ matrix.arch }}
            sudo mv -t /srv/repository/mirror/releases/server/ubuntu/versions/${{ env.JELLYFIN_VERSION }}/${{ matrix.arch }} /srv/incoming/${{ env.JELLYFIN_VERSION }}/ubuntu/${{ matrix.arch }}/${{ matrix.release }}/*
            if [[ ${{ inputs.version }} != "master" ]]; then
                sudo ln -s /srv/repository/mirror/releases/server/ubuntu/versions/${{ env.JELLYFIN_VERSION }}/${{ matrix.arch }} /srv/repository/mirror/releases/server/ubuntu/latest-server
            fi

bgstack15