0
0
mirror of https://github.com/kodi-pvr/pvr.iptvsimple.git synced 2024-11-21 20:46:35 +00:00
pvr.iptvsimple/.github/workflows/release.yml
2024-02-22 09:42:55 +00:00

67 lines
3.0 KiB
YAML

name: Make Release
# Create a release on the given branch
# Release and tag name format will be <version>-<branch>
# The body of the release will be created from the changelog.txt or news element in the addon.xml.in
on: workflow_dispatch
jobs:
default:
runs-on: ubuntu-latest
name: Make Release
steps:
# Checkout the current repository into a directory (repositories name)
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
path: ${{ github.event.repository.name }}
# Install all dependencies required by the following steps
# - libxml2-utils, xmlstarlet: reading news and version from addon.xml.in
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libxml2-utils xmlstarlet
# Create the variables required by the following steps
# - steps.required-variables.outputs.changes: latest entry in the changelog.txt (if exists), or addon.xml.in news element
# - steps.required-variables.outputs.version: version element from addon.xml.in
# - steps.required-variables.outputs.branch: branch of the triggering ref
# Note: we use a random EOF for 'changes' as is best practice for for multiline variables
- name: Get required variables
id: required-variables
run: |
changes=$(cat "$(find . -name changelog.txt)" | awk -v RS= 'NR==1')
if [ -z "$changes" ] ;
then
changes=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/extension/news)' | awk -v RS= 'NR==1')
fi
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "changes<<$EOF" >> $GITHUB_OUTPUT
echo "$changes" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)')
echo "version=$version" >> $GITHUB_OUTPUT
branch=$(echo ${GITHUB_REF#refs/heads/})
echo "branch=$branch" >> $GITHUB_OUTPUT
working-directory: ${{ github.event.repository.name }}
# Create a release at {steps.required-variables.outputs.branch}
# - tag and release name format: {steps.required-variables.outputs.version}-{steps.required-variables.outputs.branch} ie. 21.0.0-Omega
# - release body: {steps.required-variables.outputs.changes}
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.required-variables.outputs.version }}-${{ steps.required-variables.outputs.branch }}
release_name: ${{ steps.required-variables.outputs.version }}-${{ steps.required-variables.outputs.branch }}
body: ${{ steps.required-variables.outputs.changes }}
draft: false
prerelease: false
commitish: ${{ steps.required-variables.outputs.branch }}