Repository navigation
195 lines (174 loc) · 7.71 KB
/
Copy pathgithub-release.yml
File metadata and controls
195 lines (174 loc) · 7.71 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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: GitHub Release
on:
workflow_dispatch:
inputs:
dry_run:
description: "Dry Run (creates a draft GitHub release, publishes nothing)"
type: boolean
default: true
release_github:
description: "Release to GitHub"
type: boolean
default: false
workflow_call:
inputs:
auto_release:
description: "Set by the auto-release workflows: adds API Bump to the changelog when the API changed since the last release"
type: boolean
default: false
dry_run:
description: "Dry Run (creates a draft GitHub release, publishes nothing)"
type: boolean
default: true
release_github:
description: "Release to GitHub"
type: boolean
default: false
concurrency:
group: release-${{ github.repository }}
cancel-in-progress: false
permissions:
contents: read
jobs:
gate:
uses: ./.github/workflows/release-gate.yml
secrets: inherit
permissions:
contents: write
with:
auto_release: ${{ inputs.auto_release == true }}
release:
needs: gate
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: main
- name: Decide what this run does
id: mode
run: |
if [ "${{ inputs.dry_run }}" == "true" ]; then
echo "mode=dry" >> "$GITHUB_OUTPUT"
if [ "${{ inputs.release_github }}" == "true" ]; then
echo "::notice title=Dry Run Is On::Release to GitHub was checked, but Dry Run is on, so nothing is published."
fi
elif [ "${{ inputs.release_github }}" == "true" ]; then
echo "mode=real" >> "$GITHUB_OUTPUT"
else
echo "mode=none" >> "$GITHUB_OUTPUT"
echo "::warning title=Nothing To Do::Dry Run is off and Release to GitHub is not checked."
fi
- name: Read version from manifest
id: version
run: |
VER=$(grep "^## AddOnVersion:" AutoLuaMemoryCleaner.addon | awk '{print $3}')
DISPLAY_VER=$(grep "^## Version:" AutoLuaMemoryCleaner.addon | awk '{print $3}')
API_VER=$(grep "^## APIVersion:" AutoLuaMemoryCleaner.addon | awk '{print $3, $4}')
echo "Read version: $DISPLAY_VER (AddOnVersion $VER, API: $API_VER)"
echo "version=$VER" >> "$GITHUB_OUTPUT"
echo "display_version=$DISPLAY_VER" >> "$GITHUB_OUTPUT"
echo "api_version=$API_VER" >> "$GITHUB_OUTPUT"
- name: Check the LibAPH floor against the published LibAPH
uses: ./.github/actions/eso-dependency-check
with:
manifest_file: 'AutoLuaMemoryCleaner.addon'
dependency_name: 'LibAPH'
dependency_manifest_url: 'https://raw.githubusercontent.com/MPHONlC/LibAPH/main/LibAPH.addon'
dependency_release_repo: 'MPHONlC/LibAPH'
release_gate: true
- name: Build addon zip (excludes anything in .build-ignore)
run: |
mkdir -p /tmp/build/AutoLuaMemoryCleaner
rsync -a --exclude-from=.build-ignore --exclude='.*' --exclude='__*' ./ /tmp/build/AutoLuaMemoryCleaner/
cd /tmp/build && zip -r AutoLuaMemoryCleaner-${{ steps.version.outputs.display_version }}.zip AutoLuaMemoryCleaner
echo "zip_file=/tmp/build/AutoLuaMemoryCleaner-${{ steps.version.outputs.display_version }}.zip" >> "$GITHUB_ENV"
- name: Extract latest changelog entries
run: |
awk '/^\[b\]\[COLOR="Orange"\]Version / { if (found) exit; found=1 } found' CHANGELOG_BBCODE.txt > latest_changes_esoui.txt
awk '/^### Version / { if (found) exit; found=1 } found' CHANGELOG_GFM.txt > latest_changes_github.md
awk '/^# VERSION / { if (found) exit; found=1 } found' CHANGELOG_COMMONMARK.txt > latest_changes_bethesda.txt
awk '/^Version: / { if (found) exit; found=1 } found' CHANGELOG.md > latest_changes_plain.md
cat latest_changes_plain.md
- name: Create GitHub Release (dry run, draft)
id: dry_run_step
if: steps.mode.outputs.mode == 'dry'
uses: ncipollo/release-action@v1
with:
name: Version-${{ steps.version.outputs.display_version }}
tag: Version-${{ steps.version.outputs.display_version }}
artifacts: ${{ env.zip_file }}
artifactContentType: application/zip
bodyFile: latest_changes_github.md
allowUpdates: true
draft: true
makeLatest: false
- name: Annotate dry_run_step result
if: always() && steps.mode.outputs.mode == 'dry'
run: |
STATUS="${{ steps.dry_run_step.outcome }}"
if [ "$STATUS" == "success" ]; then
TITLE="GitHub Dry Run Complete"
DETAIL=""
else
TITLE="GitHub Dry Run Failed"
DETAIL=" Check the 'Create GitHub Release (dry run, draft)' step's log above. A permissions/403 error there usually means this repo's Settings > Actions > General > Workflow permissions is set to read-only. Other causes: tag already exists on a different commit, bad artifact path."
fi
echo "::notice title=$TITLE::Version ${{ steps.version.outputs.display_version }} (AddOnVersion ${{ steps.version.outputs.version }}), declared API ${{ steps.version.outputs.api_version }}.$DETAIL"
{
echo "## $TITLE"
echo ""
echo "- **Version:** ${{ steps.version.outputs.display_version }} (AddOnVersion \`${{ steps.version.outputs.version }}\`)"
echo "- **Declared API:** ${{ steps.version.outputs.api_version }}"
if [ -n "$DETAIL" ]; then
echo ""
echo "${DETAIL# }"
fi
echo ""
echo "### Changelog"
echo '```'
cat latest_changes_plain.md
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Create GitHub Release
id: real_step
if: steps.mode.outputs.mode == 'real'
uses: ncipollo/release-action@v1
with:
name: Version-${{ steps.version.outputs.display_version }}
tag: Version-${{ steps.version.outputs.display_version }}
artifacts: ${{ env.zip_file }}
artifactContentType: application/zip
bodyFile: latest_changes_github.md
allowUpdates: true
draft: false
makeLatest: true
- name: Annotate real_step result
if: always() && steps.mode.outputs.mode == 'real'
run: |
STATUS="${{ steps.real_step.outcome }}"
if [ "$STATUS" == "success" ]; then
TITLE="GitHub Release Complete"
DETAIL=""
else
TITLE="GitHub Release Failed"
DETAIL=" Check the 'Create GitHub Release' step's log above. A permissions/403 error there usually means this repo's Settings > Actions > General > Workflow permissions is set to read-only. Other causes: tag already exists on a different commit, bad artifact path."
fi
echo "::notice title=$TITLE::Version ${{ steps.version.outputs.display_version }} (AddOnVersion ${{ steps.version.outputs.version }}), declared API ${{ steps.version.outputs.api_version }}.$DETAIL"
{
echo "## $TITLE"
echo ""
echo "- **Version:** ${{ steps.version.outputs.display_version }} (AddOnVersion \`${{ steps.version.outputs.version }}\`)"
echo "- **Declared API:** ${{ steps.version.outputs.api_version }}"
if [ -n "$DETAIL" ]; then
echo ""
echo "${DETAIL# }"
fi
echo ""
echo "### Changelog"
echo '```'
cat latest_changes_plain.md
echo '```'
} >> "$GITHUB_STEP_SUMMARY"