This repository has been archived by the owner on Jul 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (50 loc) · 1.84 KB
/
Release.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
# Действие, формирующее релиз
name: Release
# Активация по ручному вызову
on:
push:
branches: [ main ]
paths: .release/Release.md
# Содержит одно задание build с названием Project release с несколькими шагами
jobs:
build:
name: Project release
runs-on: ubuntu-latest
# Константы, используемые далее по тексту
env:
PROJ: ${{ github.event.repository.name }}
TAG: '3.3.3'
steps:
# Проверка состава репозитория (без анализа, как может показаться)
- name: Checkout code
uses: actions/checkout@v3
# Формирование релиза
- name: Create release
id: create_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: v${{ env.TAG }}
name: ${{ env.PROJ }} v ${{ env.TAG }}
bodyFile: .release/Release.md
draft: false
prerelease: false
# Загрузка бинарных файлов в релиз
- name: Upload release asset
id: upload-release-asset
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs').promises;
const { repo: { owner, repo }, sha } = context;
await fs.unlink (`./.release/Release.md`);
for (let file of await fs.readdir('./.release')){
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: ${{ steps.create_release.outputs.id }},
name: file,
data: await fs.readFile(`./.release/${file}`)
});
}