-
-
Notifications
You must be signed in to change notification settings - Fork 12
94 lines (87 loc) · 3.25 KB
/
publish-release.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
84
85
86
87
88
89
90
91
92
93
94
name: Build 🏗️ and Publish 📦 release
on:
push:
tags: ['*']
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create release ${{ github.ref }} as a draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create "${{ github.ref }}" --draft --generate-notes
matrix:
name: Generate matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -yqq jq
- name: Generate matrix
id: matrix
run: |
. build-config
echo "::echo::on"
echo "::set-output name=distros::$(jq --compact-output --null-input '$ARGS.positional' --args -- "${TARGETABLE_DISTROS[@]}")"
echo "::set-output name=versions::$(jq --compact-output --null-input '$ARGS.positional' --args -- "${TARGETABLE_VERSIONS[@]}")"
EXCLUDE=""
for DISTRO in "${TARGETABLE_DISTROS[@]}"; do
for OBS_VER in "${TARGETABLE_VERSIONS[@]}"; do
./build-validate.sh "${DISTRO}" "${OBS_VER}" && continue
EXCLUDE="${EXCLUDE:+$EXCLUDE,}{\"distro\": \"${DISTRO}\", \"version\": \"${OBS_VER}\"}"
done
done
echo "::set-output name=exclude::[${EXCLUDE}]"
outputs:
distros: ${{ steps.matrix.outputs.distros }}
versions: ${{ steps.matrix.outputs.versions }}
exclude: ${{ steps.matrix.outputs.exclude }}
build:
name: Build all packages
runs-on: ubuntu-latest
needs: [create-release, matrix]
strategy:
matrix:
distro: ${{ fromJson(needs.matrix.outputs.distros) }}
version: ${{ fromJson(needs.matrix.outputs.versions) }}
exclude: ${{ fromJson(needs.matrix.outputs.exclude) }}
steps:
- uses: actions/checkout@v3
- name: Build OBS ${{ matrix.version }} for ${{ matrix.distro }}
env:
TWITCH_CLIENTID: ${{ secrets.TWITCH_CLIENTID }}
TWITCH_HASH: ${{ secrets.TWITCH_HASH }}
RESTREAM_CLIENTID: ${{ secrets.RESTREAM_CLIENTID }}
RESTREAM_HASH: ${{ secrets.RESTREAM_HASH }}
YOUTUBE_CLIENTID: ${{ secrets.YOUTUBE_CLIENTID }}
YOUTUBE_CLIENTID_HASH: ${{ secrets.YOUTUBE_CLIENTID_HASH }}
YOUTUBE_SECRET: ${{ secrets.YOUTUBE_SECRET }}
YOUTUBE_SECRET_HASH: ${{ secrets.YOUTUBE_SECRET_HASH }}
run: >
sudo --preserve-env
./build-auto.sh "${{ matrix.distro }}" "${{ matrix.version }}"
- name: Upload OBS ${{ matrix.version }} for ${{ matrix.distro }} artefacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for artefact in "artefacts/obs-portable-${{ matrix.version }}"*; do
gh release upload "${{ github.ref }}" "${artefact}" --clobber
done
publish-release:
name: Publish release
runs-on: ubuntu-latest
needs: [create-release, build]
steps:
- uses: actions/checkout@v3
- name: Publish release ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "$(gh release view "${{ github.ref }}" --json assets --template '{{len .assets}}')" -lt 0 ]; then
exit 1
fi
gh release edit "${{ github.ref }}" --draft=false