-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
143 lines (126 loc) · 4.46 KB
/
Copy pathpre-release.yaml
File metadata and controls
143 lines (126 loc) · 4.46 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
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
name: Pre-Release WinUtil
permissions:
contents: write
actions: read
pull-requests: write
on:
workflow_dispatch: # Manual trigger added
jobs:
build-runspace:
runs-on: windows-latest
outputs:
version: ${{ steps.extract_version.outputs.version }}
env:
CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_BASE64 }}
steps:
- name: Checkout Repository
uses: actions/checkout@v7
- name: Generate Dev Docs and Update JSON Links
shell: pwsh
run: |
Set-Location tools
./devdocs-generator.ps1
- name: Compile project
shell: pwsh
run: |
Set-ExecutionPolicy Bypass -Scope Process -Force; ./Compile.ps1
continue-on-error: false # Directly fail the job on error, removing the need for a separate check
- name: Create Pull Request for Updated Docs and JSON Links
id: cpr
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.AUTO_MERGE }}
commit-message: 'chore: Update generated dev docs and JSON links'
title: 'chore: Update generated dev docs and JSON links'
body: 'Automated update of generated documentation and JSON config links from pre-release build'
branch: docs-update
delete-branch: true
add-paths: |
docs/src/content/docs/code-reference/
config/tweaks.json
config/feature.json
labels: |
automated
documentation
skip-changelog
- name: Check outputs
shell: bash
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Set Version to Todays Date
id: extract_version
run: |
$version = (Get-Date -Format "yy.MM.dd")
echo "VERSION=$version" >> $env:GITHUB_ENV
echo "version=$version" >> $env:GITHUB_OUTPUT
shell: pwsh
- name: Create Tag
id: create_tag
run: |
$tagExists = git tag -l $env:VERSION
if ($tagExists -eq "") {
git tag $env:VERSION
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to create tag $env:VERSION"
exit 1
}
git push origin $env:VERSION
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to push tag $env:VERSION"
exit 1
}
} else {
Write-Host "Tag $env:VERSION already exists, skipping tag creation"
}
shell: pwsh
- name: Upload compiled script
uses: actions/upload-artifact@v7
with:
name: winutil-ps1
path: ./winutil.ps1
release:
needs: build-runspace
runs-on: ubuntu-latest
steps:
- name: Download compiled script
uses: actions/download-artifact@v8
with:
name: winutil-ps1
- name: Set version from build job
run: echo "VERSION=${{ needs.build-runspace.outputs.version }}" >> $GITHUB_ENV
- name: Generate Release Notes
id: generate_notes
uses: release-drafter/release-drafter@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config-name: release-drafter.yml
version: ${{ env.VERSION }}
- name: Remove Automated Updates from Release Notes
id: filter_notes
shell: pwsh
env:
RELEASE_NOTES: ${{ steps.generate_notes.outputs.body }}
run: |
$filteredNotes = ($env:RELEASE_NOTES -split '\r?\n' | Where-Object {
$_ -notmatch '(?i)Update (Generated Dev Docs|Sponsors)'
}) -join "`n"
$delimiter = [guid]::NewGuid().ToString()
"body<<$delimiter" >> $env:GITHUB_OUTPUT
$filteredNotes >> $env:GITHUB_OUTPUT
$delimiter >> $env:GITHUB_OUTPUT
- name: Create and Upload Release
id: create_release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ env.VERSION }}
name: Pre-Release ${{ env.VERSION }}
body: |
${{ steps.filter_notes.outputs.body }}

append_body: false
files: ./winutil.ps1
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}