-
-
Notifications
You must be signed in to change notification settings - Fork 52
154 lines (130 loc) · 4.56 KB
/
main.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
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
name: MediaFusion CI/CD
on:
release:
types: [ created ]
jobs:
update_version:
runs-on: ubuntu-latest
outputs:
previous_version: ${{ steps.extract_versions.outputs.PREVIOUS_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract versions
id: extract_versions
run: |
# Extract current version from release body
BODY="${{ github.event.release.body }}"
if ! PREVIOUS_VERSION=$(echo "$BODY" | grep -o '/compare/.*\.\.\.' | sed 's/\/compare\///' | sed 's/\.\.\.//' || true); then
echo "Error: Failed to extract previous version from release body"
exit 1
fi
echo "PREVIOUS_VERSION=${PREVIOUS_VERSION}" >> "$GITHUB_OUTPUT"
- name: Update version numbers
if: "!github.event.release.prerelease"
run: |
make update-version VERSION_NEW=${{ github.ref_name }}
- name: Commit and push version updates
if: "!github.event.release.prerelease"
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m "chore: update version to ${{ github.ref_name }}"
git push origin HEAD:main
mediafusion_docker_build:
needs: update_version
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main # Use main branch with updated versions
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
file: ./deployment/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: VERSION=${{ github.ref_name }}
tags: |
mhdzumair/mediafusion:${{ github.ref_name }}
mhdzumair/mediafusion:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
kodi_build:
needs: update_version
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main # Use main branch with updated versions
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Install required packages
run: sudo apt-get install -y zip xmlstarlet
- name: Build addon and repository
run: |
make -C kodi
# Validate build artifacts
for file in kodi/dist/plugin.video.mediafusion/plugin.video.mediafusion-*.zip kodi/dist/repository.mediafusion/repository.mediafusion-*.zip; do
if [ ! -f "$file" ]; then
echo "Error: Build artifact $file not found"
exit 1
fi
done
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: kodi/dist
enable_jekyll: false
force_orphan: true
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
with:
files: |
kodi/plugin.video.mediafusion-*.zip
kodi/repository.mediafusion-*.zip
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes:
needs: update_version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install jq
run: sudo apt-get install -y jq
- name: Generate Release Notes
run: |
make generate-notes VERSION_OLD=${{ needs.update_version.outputs.previous_version }} VERSION_NEW=${{ github.ref_name }} ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }} > release_notes.md
- name: Update Release Notes
uses: softprops/action-gh-release@v2
with:
body_path: release_notes.md
token: ${{ secrets.GITHUB_TOKEN }}