forked from vor0nwe/nppHTMLTag
-
Notifications
You must be signed in to change notification settings - Fork 4
140 lines (128 loc) · 4.52 KB
/
Copy pathbuild.yml
File metadata and controls
140 lines (128 loc) · 4.52 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
#
# SPDX-FileCopyrightText: (c) 2025 Robert Di Pardo <dipardo.r@gmail.com>
# SPDX-License-Identifier: MPL-2.0
#
name: MSVC
on:
pull_request:
push:
tags:
- '**'
branches-ignore:
- 'objpas'
- 'dependabot/**'
permissions:
contents: read
jobs:
build:
name: 'Build project with MSVC'
runs-on: windows-2022
strategy:
matrix:
target: [x86, x64, amd64_arm64]
env:
TARGETS: |
{ "x64": "x64",
"x86": "x86",
"amd64_arm64": "arm64" }
outputs:
x64_filehash: ${{ steps.artifacts.outputs.x64_filehash }}
x86_filehash: ${{ steps.artifacts.outputs.x86_filehash }}
arm64_filehash: ${{ steps.artifacts.outputs.arm64_filehash }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up MSVC
uses: TheMrMilchmann/setup-msvc-dev@79dac248aac9d0059f86eae9d8b5bfab4e95e97c # v4.0.0
with:
arch: ${{ matrix.target }}
sdk: '10.0.26100.0'
- name: Build
env:
PLATFORM: ${{ fromJSON(env.TARGETS)[matrix.target] }}
run: .\build.cmd Release ${env:PLATFORM} clean nmake
# https://fossil.2of4.net/npp_htmltag/doc/trunk/doc/HTMLTag-readme.txt
- name: HTMLTag.dll -> HTMLTag_unicode.dll
if: matrix.target == 'x86'
run: mv -Force .\HTMLTag.dll .\HTMLTag_unicode.dll
working-directory: out/${{ matrix.target }}/Release
- name: Copy build artifacts
id: artifacts
env:
PLATFORM: ${{ fromJSON(env.TARGETS)[matrix.target] }}
run: |
$hash = $(Get-FileHash -A SHA256 .\out\${env:PLATFORM}\Release\*.dll).Hash
echo "${env:PLATFORM}_filehash=${hash}" >> "${env:GITHUB_OUTPUT}"
.\dat\update_checksums.ps1
xcopy /DVY .\out\${env:PLATFORM}\Release\*.dll ".\out"
xcopy /DVY .\dat\*.ini ".\out"
xcopy /DVY .\dat\*.md5sums ".\out"
xcopy /DIY .\*.textile ".\out\Doc"
- name: Upload HTMLTag-${{ github.run_id }}-${{ env.PLATFORM }}
env:
PLATFORM: ${{ fromJSON(env.TARGETS)[matrix.target] }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: HTMLTag-${{ github.run_id }}-${{ env.PLATFORM }}
path: |
out/*.dll
out/*.ini
out/*.md5sums
out/Doc/
push_release:
name: 'Publish new release'
if: ${{ contains(github.ref, 'tags') && github.event_name == 'push' }}
needs: build
concurrency:
group: rel-${{ github.ref_name }}
cancel-in-progress: true
runs-on: ubuntu-slim
permissions:
contents: write # required by `gh release create`
env:
SLUGX86: HTMLTag_${{ github.ref_name }}.zip
SLUGX64: HTMLTag_${{ github.ref_name }}_x64.zip
SLUGARM64: HTMLTag_${{ github.ref_name }}_arm64.zip
SHA256X86: ${{ needs.build.outputs.x86_filehash }}
SHA256X64: ${{ needs.build.outputs.x64_filehash }}
SHA256ARM64: ${{ needs.build.outputs.arm64_filehash }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Fetch release artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: bin
- name: Pack release artifacts
working-directory: bin
run: |
FILEHASH=
ZIPBALL=
BINDIRS=('x86' 'x64' 'arm64')
for d in "${BINDIRS[@]}";
do
case "$d" in
'x86') ZIPBALL="${SLUGX86}"; FILEHASH="${SHA256X86}" ;;
'x64') ZIPBALL="${SLUGX64}"; FILEHASH="${SHA256X64}" ;;
'arm64') ZIPBALL="${SLUGARM64}"; FILEHASH="${SHA256ARM64}" ;;
esac
pushd ./*-${d}/ 2>&1 >/dev/null || exit 1
# ensure binary artifacts are the same ones we built
echo $FILEHASH *HTMLTag*.dll | sha256sum -c --quiet
zip "../${ZIPBALL}" ./Doc ./Doc/* ./*.{ini,md5sums,dll}
popd 2>&1 >/dev/null
done
- name: Generate release notes
working-directory: bin
run: |
ASSETS=("${SLUGX86}" "${SLUGX64}" "${SLUGARM64}")
printf '#### SHA256 Checksums\n\n' > release_notes.txt
for slug in "${ASSETS[@]}"; do printf '\t%s\n' "$(sha256sum -b "$slug")" >> release_notes.txt; done
- name: Push release
run: |
gh release create "$TAG" ./bin/*.zip --notes-file ./bin/release_notes.txt
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}