-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
104 lines (96 loc) · 3.21 KB
/
action.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: 'Build and Publish Plugin'
description: 'Automatically build and publish plugins to their GitHub repositories'
inputs:
python_version:
description: 'Python version for building.'
required: false
default: '3.11'
node_version:
description: 'Node version for building'
required: false
default: '20'
github_token:
description: 'A GitHub token with the permissions to push back to this repository'
required: true
default: ${{ github.token }}
runs:
using: 'composite'
steps:
# Checkout plugin source
- name: Checkout plugin
uses: actions/checkout@v4
with:
path: plugin
submodules: recursive
# Prepare build environment
- name: Prepare build environment
shell: bash
id: prepare
run: |
# Create dummy repo config
cat << EOF > config.json
{
"id": "repository.tmp",
"name": "Build Repo",
"icon": ""
}
EOF
# Read plugin id and version from info.json
plugin_id=$(cat plugin/info.json | jq -r .id)
plugin_version=$(cat plugin/info.json | jq -r .version)
echo "plugin_id=${plugin_id}" >> $GITHUB_OUTPUT
echo "plugin_version=${plugin_version}" >> $GITHUB_OUTPUT
# Install plugin into source directory for building
mkdir -p source/
mv -fv plugin source/${plugin_id}
# Execute plugin repo gen action
- name: Generate and Deploy Unmanic Plugin Repository
uses: Unmanic/action.generate-unmanic-plugin-repo@master
with:
python_version: ${{ inputs.python_version }}
node_version: ${{ inputs.node_version }}
deploy_repo: 'false'
github_token: ${{ inputs.github_token }}
# Upload artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: plugin.${{ steps.prepare.outputs.plugin_id }}-v${{ steps.prepare.outputs.plugin_version }}
path: repo/**/*.zip
overwrite: 'true'
# Generate tagged release (should not be updated)
- name: Check Tag Already Exists
uses: mukunku/[email protected]
id: check_tag_exists
with:
tag: ${{ steps.prepare.outputs.plugin_version }}
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
- name: Generate Tagged Release
uses: ncipollo/release-action@v1
if: steps.check_tag_exists.outputs.exists == 'false'
with:
name: "Tagged Build: ${{ steps.prepare.outputs.plugin_version }}"
body: "Versioned release"
token: ${{ inputs.github_token }}
artifacts: repo/**/*.zip
generateReleaseNotes: true
allowUpdates: false
skipIfReleaseExists: true
tag: ${{ steps.prepare.outputs.plugin_version }}
commit: master
# Generate latest development
- name: Update Latest Release
uses: ncipollo/release-action@v1
with:
name: "Development Build"
body: "Latest development release"
token: ${{ inputs.github_token }}
artifacts: repo/**/*.zip
generateReleaseNotes: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: true
tag: latest
commit: master
prerelease: true