mirror of
https://github.com/anxdpanic/plugin.video.youtube.git
synced 2026-04-08 06:42:13 -07:00
181 lines
6.4 KiB
YAML
181 lines
6.4 KiB
YAML
# Based on https://github.com/im85288/service.upnext/blob/master/.github/workflows/release.yml
|
|
name: Make Release
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
- '*-dev'
|
|
|
|
jobs:
|
|
release:
|
|
if: github.repository == 'anxdpanic/plugin.video.youtube'
|
|
|
|
name: Make Release
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
- name: Release Status
|
|
id: release
|
|
run: |
|
|
version=${GITHUB_REF/refs\/tags\//}
|
|
if [[ $version == *-dev ]] ;
|
|
then
|
|
echo "pre-release=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "pre-release=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Checkout Add-on
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: ${{ github.event.repository.name }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install libxml2-utils xmlstarlet zip
|
|
|
|
- name: Get Changelog
|
|
id: changelog
|
|
run: |
|
|
changes=$(xmlstarlet sel -t -v '//news' -n addon.xml)
|
|
changes="${changes//'%'/'%25'}"
|
|
changes="${changes//$'\n'/'%0A'}"
|
|
changes="${changes//$'\r'/'%0D'}"
|
|
echo "changes=$changes" >> $GITHUB_OUTPUT
|
|
working-directory: ${{ github.event.repository.name }}
|
|
|
|
- name: Create Zip (Isengard)
|
|
id: zip-isengard
|
|
run: |
|
|
mv .git ..
|
|
rm -rf .??*
|
|
rm *.md
|
|
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
|
|
filename=${{ github.event.repository.name }}-${version}.zip
|
|
cd ..
|
|
zip -r $filename ${{ github.event.repository.name }}
|
|
mv .git ${{ github.event.repository.name }}
|
|
echo "filename=$filename" >> $GITHUB_OUTPUT
|
|
working-directory: ${{ github.event.repository.name }}
|
|
|
|
- name: Create Zip (Isengard-Unofficial)
|
|
id: zip-unofficial-isengard
|
|
run: |
|
|
git reset
|
|
git checkout .
|
|
git clean -fdx
|
|
git apply .patches/unofficial.patch
|
|
mv .git ..
|
|
rm -rf .??*
|
|
rm *.md
|
|
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
|
|
filename=${{ github.event.repository.name }}-unofficial-${version}.zip
|
|
cd ..
|
|
zip -r $filename ${{ github.event.repository.name }}
|
|
mv .git ${{ github.event.repository.name }}
|
|
echo "filename=$filename" >> $GITHUB_OUTPUT
|
|
working-directory: ${{ github.event.repository.name }}
|
|
|
|
- name: Remove Repository
|
|
id: remove-repo
|
|
run: |
|
|
rm -rf ${{ github.event.repository.name }}
|
|
|
|
- name: Checkout Add-on
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: ${{ github.event.repository.name }}
|
|
|
|
- name: Create Zip (Matrix)
|
|
id: zip-matrix
|
|
run: |
|
|
git apply .patches/matrix.patch
|
|
mv .git ..
|
|
rm -rf .??*
|
|
rm *.md
|
|
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
|
|
xmlstarlet ed -L -u '/addon/@version' -v "${version}+matrix.1" addon.xml
|
|
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
|
|
filename=${{ github.event.repository.name }}-${version}.zip
|
|
cd ..
|
|
zip -r $filename ${{ github.event.repository.name }}
|
|
mv .git ${{ github.event.repository.name }}
|
|
echo "filename=$filename" >> $GITHUB_OUTPUT
|
|
working-directory: ${{ github.event.repository.name }}
|
|
|
|
- name: Create Zip (Matrix-Unofficial)
|
|
id: zip-unofficial-matrix
|
|
run: |
|
|
git reset
|
|
git checkout .
|
|
git clean -fdx
|
|
git apply .patches/matrix-unofficial.patch
|
|
mv .git ..
|
|
rm -rf .??*
|
|
rm *.md
|
|
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
|
|
xmlstarlet ed -L -u '/addon/@version' -v "${version}+matrix.1" addon.xml
|
|
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
|
|
filename=${{ github.event.repository.name }}-unofficial-${version}.zip
|
|
cd ..
|
|
zip -r $filename ${{ github.event.repository.name }}
|
|
mv .git ${{ github.event.repository.name }}
|
|
echo "filename=$filename" >> $GITHUB_OUTPUT
|
|
working-directory: ${{ github.event.repository.name }}
|
|
|
|
- name: Create Release
|
|
id: create-release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: ${{ github.ref }}
|
|
body: ${{ steps.changelog.outputs.changes }}
|
|
draft: false
|
|
prerelease: ${{ steps.release.outputs.pre-release }}
|
|
|
|
- name: Upload Zip (Isengard)
|
|
id: upload-isengard
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
|
asset_name: ${{ steps.zip-isengard.outputs.filename }}
|
|
asset_path: ${{ steps.zip-isengard.outputs.filename }}
|
|
asset_content_type: application/zip
|
|
|
|
- name: Upload Zip (Isengard-Unofficial)
|
|
id: upload-unofficial-isengard
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
|
asset_name: ${{ steps.zip-unofficial-isengard.outputs.filename }}
|
|
asset_path: ${{ steps.zip-unofficial-isengard.outputs.filename }}
|
|
asset_content_type: application/zip
|
|
|
|
- name: Upload Zip (Matrix)
|
|
id: upload-matrix
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
|
asset_name: ${{ steps.zip-matrix.outputs.filename }}
|
|
asset_path: ${{ steps.zip-matrix.outputs.filename }}
|
|
asset_content_type: application/zip
|
|
|
|
- name: Upload Zip (Matrix-Unofficial)
|
|
id: upload-unofficial-matrix
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
|
asset_name: ${{ steps.zip-unofficial-matrix.outputs.filename }}
|
|
asset_path: ${{ steps.zip-unofficial-matrix.outputs.filename }}
|
|
asset_content_type: application/zip
|