-
-
Notifications
You must be signed in to change notification settings - Fork 7
137 lines (119 loc) · 5.77 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
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.16 1.17 1.18 1.19 1.20 1.21; do
zip -r Rus-For-Mods-$version-Dev-${{ steps.get_latest_release.outputs.next_version }}.zip "$version/assets" "$version/dynamicmcpack.json" "$version/pack.mcmeta" "pack.png" "PeruseOrBruise.txt"
done
- 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: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: dev${{ steps.get_latest_release.outputs.next_version }}
release_name: Предварительная редакция №${{ steps.get_latest_release.outputs.next_version }}
draft: false
prerelease: false
- 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