generated from Ivan-1F/MCDReforged-PluginTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (55 loc) · 1.79 KB
/
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
name: Release
on:
release:
types:
- published
workflow_dispatch:
inputs:
target_release_tag:
description: The tag of the release you want to append the artifact to
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mcdreforged
pip install -r requirements.txt
- name: Pack the plugin
run: python -m mcdreforged pack -o dist
- name: Generate publish related infomation
id: release_info
run: |
if [ $GITHUB_EVENT_NAME == 'release' ]
then
echo "::set-output name=tag_name::" # leave an empty value here so softprops/action-gh-release will use the default value
elif [ $GITHUB_EVENT_NAME == 'workflow_dispatch' ]
then
echo "::set-output name=tag_name::${{ github.event.inputs.target_release_tag }}"
else
echo Unknown github event name $GITHUB_EVENT_NAME
exit 1
fi
- name: Find packed plugin
id: findplugin
run: |
output="$(ls dist)"
echo "::set-output name=pluginname::$output"
- name: Upload to Github release
uses: softprops/action-gh-release@v1
with:
files: dist/${{ steps.findplugin.outputs.pluginname }}
tag_name: ${{ steps.release_info.outputs.tag_name }}