mirror of
https://github.com/DigitalDevices/pvr.octonet.git
synced 2023-10-10 13:36:57 +02:00
Merge pull request #50 from phunkyfish/release-only
Worflow to release using current changelog and version
This commit is contained in:
commit
2325d7ff2d
66
.github/workflows/release.yml
vendored
Normal file
66
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
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@v2
|
||||||
|
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 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
|
||||||
|
- 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
|
||||||
|
changes="${changes//'%'/'%25'}"
|
||||||
|
changes="${changes//$'\n'/'%0A'}"
|
||||||
|
changes="${changes//$'\r'/'%0D'}"
|
||||||
|
changes="${changes//$'\\n'/'%0A'}"
|
||||||
|
changes="${changes//$'\\r'/'%0D'}"
|
||||||
|
echo ::set-output name=changes::$changes
|
||||||
|
version=$(xmlstarlet fo -R "$(find . -name addon.xml.in)" | xmlstarlet sel -t -v 'string(/addon/@version)')
|
||||||
|
echo ::set-output name=version::$version
|
||||||
|
branch=$(echo ${GITHUB_REF#refs/heads/})
|
||||||
|
echo ::set-output name=branch::$branch
|
||||||
|
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. 1.0.0-Matrix
|
||||||
|
# - 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 }}
|
Loading…
Reference in New Issue
Block a user