File: docker-build.yml

package info (click to toggle)
obs-command-source 0.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 284 kB
  • sloc: ansic: 400; python: 80; sh: 75; makefile: 21; cpp: 16
file content (81 lines) | stat: -rw-r--r-- 2,373 bytes parent folder | download | duplicates (2)
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
name: Plugin Build on Docker

on:
  push:
    paths-ignore:
      - '**.md'
    branches:
      - main
    tags:
      - '*'
  pull_request:
    paths-ignore:
      - '**.md'
    branches:
      - main

env:
  artifactName: ${{ contains(github.ref_name, '/') && 'docker-artifact' || github.ref_name }}-rpm

jobs:
  docker_build:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        target:
          - fedora38
          - fedora39
    defaults:
      run:
        shell: bash
    env:
      target: ${{ matrix.target }}

    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          submodules: recursive

      - name: Generate container directory
        run: |
          cp -a .github/containers/fedora-template .github/containers/$target
          releasever="$(cut -b 7- <<< "$target")"
          sed -i "s/%releasever%/$releasever/g" .github/containers/$target/*

      - name: Restore docker from cache
        id: docker-cache
        uses: actions/cache/restore@v4
        with:
          path: ${{ github.workspace }}/docker-cache
          key: docker-cache-${{ matrix.target }}-${{ hashFiles(format('.github/containers/{0}/Dockerfile', matrix.target)) }}

      - name: Build environment
        if: ${{ steps.docker-cache.outputs.cache-hit != 'true' }}
        run: |
          docker build -t obs-plugin-build/$target .github/containers/$target
          mkdir -p docker-cache
          docker save obs-plugin-build/$target | gzip > docker-cache/obs-plugin-build-$target.tar.gz

      - name: Save docker to cache
        uses: actions/cache/save@v4
        if: ${{ steps.docker-cache.outputs.cache-hit != 'true' }}
        with:
          path: ${{ github.workspace }}/docker-cache
          key: docker-cache-${{ matrix.target }}-${{ hashFiles(format('.github/containers/{0}/Dockerfile', matrix.target)) }}

      - name: Extract cached environment
        if: ${{ steps.docker-cache.outputs.cache-hit == 'true' }}
        run: |
          zcat docker-cache/obs-plugin-build-$target.tar.gz | docker load

      - name: Build package
        run: .github/containers/$target/build.sh

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: ${{ env.artifactName }}-${{ matrix.target }}
          path: '${{ env.FILE_NAME }}'