-
Notifications
You must be signed in to change notification settings - Fork 14
87 lines (77 loc) · 2.63 KB
/
make-release.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
# 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.tubed'
name: Make Release
runs-on: ubuntu-latest
steps:
- name: Release Status
id: release
run: |
version=${GITHUB_REF/refs\/tags\//}
if [[ $version == *-dev ]] ;
then
echo ::set-output name=pre-release::true
else
echo ::set-output name=pre-release::false
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 ::set-output name=changes::$changes
working-directory: ${{ github.event.repository.name }}
- name: Remove Unwanted Files
run: |
mv .git ..
rm -rf .??*
rm LICENSE.md
rm README.md
working-directory: ${{ github.event.repository.name }}
- name: Create Zip (Nexus)
id: zip-nexus
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 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 (Nexus)
id: upload-nexus
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-nexus.outputs.filename }}
asset_path: ${{ steps.zip-nexus.outputs.filename }}
asset_content_type: application/zip