Skip to content

Commit aa5e985

Browse files
committed
chore: add github actions (#1)
Signed-off-by: Kevin Cui <[email protected]>
1 parent e228f05 commit aa5e985

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
test:
10+
runs-on: windows-latest
11+
steps:
12+
- name: Install FPC
13+
run: |
14+
cd "$Env:RUNNER_TEMP"
15+
16+
# Must i386, See: https://github.com/Bill-Stewart/UninsIS/pull/7#issuecomment-2790769116
17+
curl -LO 'http://downloads.sourceforge.net/project/freepascal/Win32/3.2.2/fpc-3.2.2.i386-win32.exe'
18+
.\fpc-3.2.2.i386-win32.exe /VERYSILENT /SP- /DIR="$Env:RUNNER_TEMP\fpc" | Out-Null
19+
20+
echo "$Env:RUNNER_TEMP\fpc\bin\i386-win32" >> $Env:GITHUB_PATH
21+
22+
echo "$Env:GITHUB_PATH"
23+
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Add Dependencies
28+
# Ref: https://github.com/Bill-Stewart/UninsIS/blob/e228f0511aea95282a7919f90191c4dd69165f6f/ISPackage.pp#L56-L59
29+
run: |
30+
gh api repos/Bill-Stewart/VersionStrings/contents/VersionStrings.pp -q '.download_url' | xargs curl -O
31+
gh api repos/Bill-Stewart/WindowsRegistry/contents/WindowsRegistry.pp -q '.download_url' | xargs curl -O
32+
gh api repos/Bill-Stewart/WindowsString/contents/WindowsString.pp -q '.download_url' | xargs curl -O
33+
env:
34+
GH_TOKEN: ${{ github.token }}
35+
36+
- name: Build
37+
run: |
38+
windres.exe .\UninsIS.rc -o UninsIS.res
39+
fpc.exe -CX -O3 -WR -Xs -XX UninsIS.pp
40+
41+
- name: Gen Release Notes
42+
run: |
43+
$sha256 = (Get-FileHash -Path UninsIS.dll -Algorithm SHA256).Hash.ToLower()
44+
45+
Set-Content -Path release_notes.md -Value '```'
46+
Add-Content -Path release_notes.md -Value "$sha256 UninsIS.dll"
47+
Add-Content -Path release_notes.md -Value '```'
48+
49+
- name: Release
50+
uses: softprops/action-gh-release@v2
51+
with:
52+
files: |
53+
UninsIS.dll
54+
generate_release_notes: true
55+
body_path: release_notes.md
56+
draft: false
57+
prerelease: false
58+
fail_on_unmatched_files: true
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
runs-on: windows-latest
11+
steps:
12+
- name: Install FPC
13+
run: |
14+
cd "$Env:RUNNER_TEMP"
15+
16+
# Must i386, See: https://github.com/Bill-Stewart/UninsIS/pull/7#issuecomment-2790769116
17+
curl -LO 'http://downloads.sourceforge.net/project/freepascal/Win32/3.2.2/fpc-3.2.2.i386-win32.exe'
18+
.\fpc-3.2.2.i386-win32.exe /VERYSILENT /SP- /DIR="$Env:RUNNER_TEMP\fpc" | Out-Null
19+
20+
echo "$Env:RUNNER_TEMP\fpc\bin\i386-win32" >> $Env:GITHUB_PATH
21+
22+
echo "$Env:GITHUB_PATH"
23+
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Add Dependencies
28+
# Ref: https://github.com/Bill-Stewart/UninsIS/blob/e228f0511aea95282a7919f90191c4dd69165f6f/ISPackage.pp#L56-L59
29+
run: |
30+
gh api repos/Bill-Stewart/VersionStrings/contents/VersionStrings.pp -q '.download_url' | xargs curl -O
31+
gh api repos/Bill-Stewart/WindowsRegistry/contents/WindowsRegistry.pp -q '.download_url' | xargs curl -O
32+
gh api repos/Bill-Stewart/WindowsString/contents/WindowsString.pp -q '.download_url' | xargs curl -O
33+
env:
34+
GH_TOKEN: ${{ github.token }}
35+
36+
- name: Build
37+
run: |
38+
windres.exe .\UninsIS.rc -o UninsIS.res
39+
fpc.exe -CX -O3 -WR -Xs -XX UninsIS.pp
40+
41+
- name: Upload artifact
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: UninsIS
45+
path: |
46+
UninsIS.dll
47+
if-no-files-found: error
48+
overwrite: true
49+
retention-days: 5

0 commit comments

Comments
 (0)