-
-
Notifications
You must be signed in to change notification settings - Fork 7
176 lines (156 loc) · 8.51 KB
/
dev_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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Мастер выпуска предварительных редакций
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Клонирование репозитория
uses: actions/checkout@v2
- name: Установка утилиты ZIP
run: sudo apt-get install -y zip
- name: Проверка последнего предварительного выпуска
id: get_latest_release
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const token = core.getInput("github-token");
const headers = {
"Authorization": `token ${token}`,
"Accept": "application/vnd.github.v3+json"
};
const response = await fetch(`https://api.github.com/repos/${context.repo.owner}/${context.repo.repo}/releases`, {
method: "GET",
headers: headers
});
const releases = await response.json();
let next_version;
if (releases.length === 0) {
next_version = 1;
} else {
const latestRelease = releases.find(release => release.tag_name.startsWith('dev'));
if (latestRelease) {
const latestVersion = parseInt(latestRelease.tag_name.replace('dev', ''));
next_version = latestVersion + 1;
} else {
next_version = 1;
}
}
core.setOutput('next_version', next_version);
- name: Создание архивов редакций для каждой из веток
run: |
for version in 1.7 1.16 1.17 1.18 1.19 1.20 1.21; do
cd $version
zip -r ../Rus-For-Mods-$version-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip assets dynamicmcpack.json pack.mcmeta
cd ..
zip -g Rus-For-Mods-$version-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip pack.png PeruseOrBruise.txt
done
cd "Сборки/Monifactory/Перевод/"
zip -r ../../../Monifactory-Russian-Translation-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip .
cd ../../../
cd "Сборки/The Ferret Business/Перевод/"
zip -r ../../../The-Ferret-Business-Russian-Translation-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip .
cd ../../../
- name: Создание тега для выпуска
id: create_tag
run: |
tag_name="dev${{ steps.get_latest_release.outputs.next_version }}"
git tag $tag_name
git push origin $tag_name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Создание выпуска
id: create_release
uses: softprops/action-gh-release@v2
env:
token: ${{ secrets.GITHUB_TOKEN }}
with:
body: Это автоматический выпуск со всеми последними изменениями. Обратите внимание, что изменения, совершённые в этом выпуске, не проверены для выпуска и могут быть некорректными. О них НЕ НУЖНО сообщать разработчику, так как все проблемы скорее всего будут рано или поздно исправлены в следующих предварительных редакциях.
tag_name: dev${{ steps.get_latest_release.outputs.next_version }}
name: Предварительные редакции №${{ steps.get_latest_release.outputs.next_version }}
draft: false
prerelease: true
- name: Загрузка архива ветки 1.7 в выпуск
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Rus-For-Mods-1.7-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_name: Rus-For-Mods-1.7-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_content_type: application/zip
- name: Загрузка архива ветки 1.16 в выпуск
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Rus-For-Mods-1.16-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_name: Rus-For-Mods-1.16-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_content_type: application/zip
- name: Загрузка архива ветки 1.17 в выпуск
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Rus-For-Mods-1.17-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_name: Rus-For-Mods-1.17-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_content_type: application/zip
- name: Загрузка архива ветки 1.18 в выпуск
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Rus-For-Mods-1.18-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_name: Rus-For-Mods-1.18-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_content_type: application/zip
- name: Загрузка архива ветки 1.19 в выпуск
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Rus-For-Mods-1.19-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_name: Rus-For-Mods-1.19-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_content_type: application/zip
- name: Загрузка архива ветки 1.20 в выпуск
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Rus-For-Mods-1.20-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_name: Rus-For-Mods-1.20-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_content_type: application/zip
- name: Загрузка архива ветки 1.21 в выпуск
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Rus-For-Mods-1.21-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_name: Rus-For-Mods-1.21-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_content_type: application/zip
- name: Загрузка архива перевода Monifactory в выпуск
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Monifactory-Russian-Translation-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_name: Monifactory-Russian-Translation-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_content_type: application/zip
- name: Загрузка архива перевода «Хорькового бизнеса» в выпуск
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./The-Ferret-Business-Russian-Translation-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_name: The-Ferret-Business-Russian-Translation-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip
asset_content_type: application/zip