-
Notifications
You must be signed in to change notification settings - Fork 2
106 lines (92 loc) 路 3.3 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
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
name: Release
on:
pull_request_target:
branches:
- main
types:
- closed
jobs:
release:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: "14"
- uses: actions/checkout@v2
with:
path: CrimicCosmos
- uses: actions/checkout@v2
with:
path: CrimicCosmos-main
ref: main
fetch-depth: 0
- name: Reset latest merge
run: |
cd CrimicCosmos-main
git reset --hard HEAD~1
cd ..
- name: Get main metadata
id: mainMetadata
run: |
NAME=`cat CrimicCosmos-main/_metadata | jq -r .name`
VERSION=`cat CrimicCosmos-main/_metadata | jq -r .version`
echo "NAME=${NAME}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "VERSION: ${VERSION}"
- name: Get current metadata
id: metadata
run: |
NAME=`cat CrimicCosmos/_metadata | jq -r .name`
VERSION=`cat CrimicCosmos/_metadata | jq -r .version`
echo "NAME=${NAME}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "FILENAME=${NAME}-${VERSION}.pak" >> $GITHUB_OUTPUT
echo "VERSION: ${VERSION}"
- uses: actions/checkout@v2
if: ${{ steps.mainMetadata.outputs.VERSION != steps.metadata.outputs.VERSION }}
with:
repository: damianb/sbpak
path: sbpak
- name: Install sbpak
if: ${{ steps.mainMetadata.outputs.VERSION != steps.metadata.outputs.VERSION }}
run: |
cd sbpak
npm i
cd ..
- name: Pack
if: ${{ steps.mainMetadata.outputs.VERSION != steps.metadata.outputs.VERSION }}
run: npx sbpak pack CrimicCosmos ${{ steps.metadata.outputs.FILENAME }}
- name: Create a Release
if: ${{ steps.mainMetadata.outputs.VERSION != steps.metadata.outputs.VERSION }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.metadata.outputs.VERSION }}
release_name: v${{ steps.metadata.outputs.VERSION }}
draft: false
prerelease: false
- name: Upload Release Asset
if: ${{ steps.mainMetadata.outputs.VERSION != steps.metadata.outputs.VERSION }}
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.metadata.outputs.FILENAME }}
asset_name: ${{ steps.metadata.outputs.FILENAME }}
asset_content_type: application/octet-stream
- name: Released comment
if: ${{ steps.mainMetadata.outputs.VERSION != steps.metadata.outputs.VERSION }}
uses: actions/github-script@v4
with:
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `# 銉儶銉笺偣銇屽畬浜嗐仐銇俱仐銇焅n\n${{ steps.create_release.outputs.html_url }}`
})