Merge pull request #165 from anxdpanic/dev #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://github.com/im85288/service.upnext/blob/master/.github/workflows/release.yml | |
name: Make Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
release: | |
if: github.repository == 'XBMC-Addons/service.xbmc.versioncheck' | |
name: Make Release | |
runs-on: ubuntu-latest | |
steps: | |
- 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 ::set-output name=changes::$changes | |
working-directory: ${{ github.event.repository.name }} | |
- name: Remove Unwanted Files | |
run: | | |
mv .git .. | |
rm -rf .??* | |
rm *.md | |
working-directory: ${{ github.event.repository.name }} | |
- name: Create Zip (Leia) | |
id: zip-leia | |
run: | | |
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 }} | |
echo ::set-output name=filename::$filename | |
working-directory: ${{ github.event.repository.name }} | |
- name: Create Zip (Matrix) | |
id: zip-matrix | |
run: | | |
xmlstarlet ed -L -u '//import[@addon="xbmc.python"]/@version' -v "3.0.0" addon.xml | |
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 }} | |
echo ::set-output name=filename::$filename | |
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: false | |
- name: Upload Zip (Leia) | |
id: upload-leia | |
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-leia.outputs.filename }} | |
asset_path: ${{ steps.zip-leia.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 |