-
Notifications
You must be signed in to change notification settings - Fork 3
108 lines (91 loc) · 2.98 KB
/
packer.yaml
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
105
106
107
108
name: Packer
on:
pull_request_target:
push:
branches:
- 'master'
env:
NAME: Minecraft-Mod-Language-Package-Not-Included-Language-Package
jobs:
pack:
runs-on: ubuntu-latest
name: Pack
outputs:
version: ${{ steps.pack.outputs.version }}
steps:
- name: Check Out master
uses: actions/checkout@v3
if: github.event_name == 'push'
- name: Check Out ${{ github.event.pull_request.head.sha }}
uses: actions/checkout@v3
if: github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Pack
id: pack
run: python Packer.py
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.NAME }}
path: ${{ steps.pack.outputs.version }}/
create-release:
runs-on: ubuntu-latest
name: Create Release
needs: pack
if: ${{ github.event_name == 'push' }}
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.NAME }}
path: ${{ env.NAME }}
- name: Zip
run: cd ${{ env.NAME }} && zip -r ../${{ env.NAME }}.zip ./* && cd ..
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.pack.outputs.version }}
release_name: AutoRelease-${{ needs.pack.outputs.version }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.NAME }}.zip
asset_name: ${{ env.NAME }}.zip
asset_content_type: application/zip
comment-pr:
runs-on: ubuntu-latest
name: Comment PR
needs: pack
if: ${{ github.event_name == 'pull_request_target' }}
steps:
- name: Find Comment
id: find_comment
uses: peter-evans/find-comment@v2
with:
issue-number: ${{ github.event.number }}
comment-author: github-actions[bot]
direction: first
- name: Create Comment
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.number }}
body: 在 [这里](../actions/runs/${{ github.run_id }}) 下载此 PR 的最新打包。
if: steps.find_comment.outputs.comment-id == 0
- name: Update Comment
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.find_comment.outputs.comment-id }}
body: 在 [这里](../actions/runs/${{ github.run_id }}) 下载此 PR 的最新打包。
edit-mode: replace
if: steps.find_comment.outputs.comment-id != 0