-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (51 loc) · 1.95 KB
/
release.yml
File metadata and controls
64 lines (51 loc) · 1.95 KB
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
name: Build and Release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: windows-latest
steps:
- name: Checkout do código
uses: actions/checkout@v4
- name: Atualizar versão no extension.yaml
run: |
$version = "${{ github.ref_name }}".TrimStart("v")
(Get-Content extension.yaml) -replace '^Version:.*', "Version: $version" |
Set-Content extension.yaml
- name: Compilar projeto
run: dotnet build GameTaskPlugin.csproj -c Release
- name: Criar o .pext
id: pext
run: |
$version = "${{ github.ref_name }}".TrimStart("v")
$pextName = "GameTask-$version.pext"
Compress-Archive -Force -Path @(
"bin\Release\net48\GameTaskPlugin.dll",
"extension.yaml",
"icon.png"
) -DestinationPath "tmp.zip"
Rename-Item -Path "tmp.zip" -NewName $pextName
echo "PEXT_NAME=$pextName" >> $env:GITHUB_OUTPUT
- name: Extrair notas do CHANGELOG
id: changelog
run: |
$tag = "${{ github.ref_name }}"
$content = Get-Content CHANGELOG.md -Raw
# Captura o bloco entre o cabeçalho da tag atual e o próximo cabeçalho ##
$pattern = "(?s)##\s*\[$tag\][^\n]*\n(.+?)(?=\n## \[|$)"
$match = [regex]::Match($content, $pattern)
if ($match.Success) {
$notes = $match.Groups[1].Value.Trim()
} else {
$notes = "See CHANGELOG.md for details."
}
# Salva em arquivo para evitar problemas com caracteres especiais
Set-Content -Path "release_notes.md" -Value $notes -Encoding UTF8
echo "NOTES_FILE=release_notes.md" >> $env:GITHUB_OUTPUT
- name: Publicar Release no GitHub
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.pext.outputs.PEXT_NAME }}
body_path: ${{ steps.changelog.outputs.NOTES_FILE }}