Skip to content

Commit a4277d4

Browse files
Add real release + config options (#64)
* cleanup `CrawlExternalPage` function name * add retry configuration values * use `Headers.RetryAfter` instead of manual code * added install and release workflows * cleaned up assembly name * added binary validation * updated `release.yaml` stage * split CI/CD docs into its own repo
1 parent f4ac92c commit a4277d4

File tree

10 files changed

+1707
-36
lines changed

10 files changed

+1707
-36
lines changed

.github/workflows/pr_validation.yaml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,58 @@ jobs:
3333
with:
3434
global-json-file: "./global.json"
3535

36+
- name: "Update version info from release notes"
37+
run: pwsh ./build.ps1
38+
3639
- name: "dotnet build"
3740
run: dotnet build -c Release
3841

3942
- name: "dotnet test"
40-
run: dotnet test -c Release
43+
run: dotnet test -c Release
44+
45+
validate-binary:
46+
name: Validate Binary
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- name: "Checkout"
51+
uses: actions/[email protected]
52+
with:
53+
lfs: true
54+
fetch-depth: 0
55+
56+
- name: "Install .NET SDK"
57+
uses: actions/[email protected]
58+
with:
59+
global-json-file: "./global.json"
60+
61+
- name: "Update version info from release notes"
62+
run: pwsh ./build.ps1
63+
64+
- name: "Publish single-file binary"
65+
run: |
66+
dotnet publish src/LinkValidator \
67+
--configuration Release \
68+
--runtime linux-x64 \
69+
--self-contained false \
70+
--output ./publish
71+
72+
- name: "Test binary functionality"
73+
run: |
74+
chmod +x ./publish/link-validator
75+
76+
echo "Testing --version flag..."
77+
./publish/link-validator --version
78+
79+
echo "Testing --help flag..."
80+
./publish/link-validator --help
81+
82+
echo "Testing invalid URL handling..."
83+
if ./publish/link-validator --url "not-a-valid-url" 2>/dev/null; then
84+
echo "ERROR: Should have failed with invalid URL"
85+
exit 1
86+
else
87+
echo "✓ Correctly rejected invalid URL"
88+
fi
89+
90+
echo "✓ Binary validation passed"

.github/workflows/release.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
PROJECT_PATH: 'src/LinkValidator'
10+
11+
jobs:
12+
build:
13+
name: Build Release Binaries
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
runtime: [win-x64, linux-x64, osx-x64, osx-arm64]
18+
include:
19+
- runtime: win-x64
20+
extension: '.exe'
21+
archive-name: 'link-validator-windows-x64'
22+
- runtime: linux-x64
23+
extension: ''
24+
archive-name: 'link-validator-linux-x64'
25+
- runtime: osx-x64
26+
extension: ''
27+
archive-name: 'link-validator-macos-x64'
28+
- runtime: osx-arm64
29+
extension: ''
30+
archive-name: 'link-validator-macos-arm64'
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Setup .NET
39+
uses: actions/setup-dotnet@v4
40+
with:
41+
global-json-file: global.json
42+
43+
- name: Update version info from release notes
44+
run: pwsh ./build.ps1
45+
46+
- name: Restore dependencies
47+
run: dotnet restore
48+
49+
- name: Build and publish
50+
run: |
51+
dotnet publish ${{ env.PROJECT_PATH }} \
52+
-c Release \
53+
-r ${{ matrix.runtime }} \
54+
--self-contained false \
55+
-o publish/${{ matrix.runtime }}
56+
57+
- name: Create archive
58+
run: |
59+
cd publish/${{ matrix.runtime }}
60+
if [ "${{ matrix.runtime }}" == "win-x64" ]; then
61+
zip -r ../../${{ matrix.archive-name }}.zip link-validator${{ matrix.extension }}
62+
else
63+
tar -czf ../../${{ matrix.archive-name }}.tar.gz link-validator${{ matrix.extension }}
64+
fi
65+
66+
- name: Upload artifact
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: ${{ matrix.archive-name }}
70+
path: |
71+
${{ matrix.archive-name }}.zip
72+
${{ matrix.archive-name }}.tar.gz
73+
if-no-files-found: ignore
74+
75+
release:
76+
name: Create Release
77+
needs: build
78+
runs-on: ubuntu-latest
79+
permissions:
80+
contents: write
81+
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v4
85+
86+
- name: Download all artifacts
87+
uses: actions/download-artifact@v4
88+
with:
89+
path: artifacts
90+
91+
- name: Extract version from tag
92+
id: version
93+
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
94+
95+
- name: Read release notes
96+
id: release_notes
97+
run: |
98+
if [ -f "RELEASE_NOTES.md" ]; then
99+
echo "notes<<EOF" >> $GITHUB_OUTPUT
100+
cat RELEASE_NOTES.md >> $GITHUB_OUTPUT
101+
echo "EOF" >> $GITHUB_OUTPUT
102+
else
103+
echo "notes=Release ${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
104+
fi
105+
106+
- name: Create Release
107+
uses: softprops/action-gh-release@v2
108+
with:
109+
name: ${{ steps.version.outputs.version }}
110+
body: ${{ steps.release_notes.outputs.notes }}
111+
files: |
112+
artifacts/**/*.zip
113+
artifacts/**/*.tar.gz
114+
draft: false
115+
prerelease: ${{ contains(steps.version.outputs.version, '-') }}
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)