Skip to content

Commit 49cd638

Browse files
authored
Merge pull request #9 from timunie/cicd
Creating zip files instead of website
2 parents 651e9fb + ca40a7c commit 49cd638

File tree

3 files changed

+65
-21
lines changed

3 files changed

+65
-21
lines changed

.github/workflows/deploy.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Deploy
33
on:
44
push:
55
branches:
6-
- cicd
6+
- cicd
77

88
jobs:
9-
build_and_deploy_job:
9+
build_job:
1010
if: github.event_name == 'push'
1111
runs-on: windows-latest
1212
name: Build and Deploy Job
@@ -19,7 +19,7 @@ jobs:
1919
dotnet-version: '9.0.x'
2020
- uses: actions/setup-node@v3
2121
with:
22-
node-version: 22.14
22+
node-version: 22.14
2323
- uses: pnpm/action-setup@v4
2424
with:
2525
version: 10.7.0
@@ -29,15 +29,37 @@ jobs:
2929
run: dotnet workload restore ext/Avalonia/src/Android/Avalonia.Android/Avalonia.Android.csproj
3030
- name: Run build script
3131
run: ./build.ps1 -version 11.2.6 -pack
32-
- name: Find
32+
- name: find
3333
shell: bash
34-
run: find ./website/build
35-
- uses: actions/upload-artifact@v4
34+
run: find ./artifacts.zip
35+
- name: Upload SFHB result temporarily as atifact
36+
uses: actions/upload-artifact@v4
3637
with:
3738
name: website-artifact
3839
path: ./artifacts.zip
3940
retention-days: 1
40-
# - name: Setup key
41-
# run: echo '${{ secrets.DEPLOY_KEY }}' > ./upload.key && chmod 700 ./upload.key
42-
# - name: Build And Deploy
43-
# run: ./deploy.sh $DEPLOY_ARGS
41+
# - name: Setup key
42+
# run: echo '${{ secrets.DEPLOY_KEY }}' > ./upload.key && chmod 700 ./upload.key
43+
# - name: Build And Deploy
44+
# run: ./deploy.sh $DEPLOY_ARGS
45+
docusaurus_deploy_job:
46+
runs-on: ubuntu-latest
47+
name: Build website
48+
needs: build_job
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: actions/download-artifact@v4
52+
with:
53+
name: website-artifact
54+
path: ./website/artifacts.zip
55+
- uses: actions/setup-node@v3
56+
with:
57+
node-version: 22.14
58+
- uses: pnpm/action-setup@v4
59+
with:
60+
version: 10.7.0
61+
- name: Run build script
62+
run: ./website/build.ps1 -build
63+
- name: find
64+
shell: bash
65+
run: find ./artifacts.zip

build.ps1

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ foreach ($proj in $avaloniaProjects){
6767
Write-Host "built $proj"
6868
}
6969

70-
# Run the docs. Comment either one
71-
cd website
72-
7370
# Set the current version name for the drop-down. For now, only one version can be documented.
7471
$versionSettings =
7572
@"
@@ -80,23 +77,23 @@ export const versionSettings = {
8077
};
8178
"@
8279

83-
New-item versionSettings.js -ItemType File -Value $versionSettings -Force
80+
New-item ./website/versionSettings.js -ItemType File -Value $versionSettings -Force
8481

8582
# preview the website if preview switch is on
8683
if($preview.IsPresent){
87-
# Make sure all dependencies are installed and up to date
88-
pnpm install
89-
pnpm start
84+
pushd ./website
85+
./build.ps1 -preview
86+
popd
9087
}
9188

9289
# build the website if build switch is on
9390
if($build.IsPresent){
94-
# Make sure all dependencies are installed and up to date
95-
pnpm install
96-
pnpm build
91+
pushd ./website
92+
./build.ps1 -build
93+
popd
9794
}
9895

9996
# pack the md-files and version settings if pack switch is on
10097
if($pack.IsPresent){
101-
Compress-Archive -Path ./docs, .\versionSettings.js -DestinationPath ../artifacts.zip
98+
Compress-Archive -Path ./website/docs, ./website/versionSettings.js -DestinationPath ./artifacts.zip -Force
10299
}

website/build.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
param (
2+
[Parameter(HelpMessage="Opens a preview of the website")]
3+
[switch]$preview,
4+
5+
[Parameter(HelpMessage="Produces an optimized website")]
6+
[switch]$build
7+
)
8+
9+
# Unpack any artifacts if available
10+
if(Test-Path .\artifacts.zip){
11+
Expand-Archive -Path ./artifacts.zip -DestinationPath ./ -Force
12+
}
13+
14+
# Make sure all dependencies are installed and up to date
15+
pnpm install
16+
17+
# preview the website if preview switch is on
18+
if($preview.IsPresent){
19+
pnpm start
20+
}
21+
22+
# build the website if build switch is on
23+
if($build.IsPresent){
24+
pnpm build
25+
}

0 commit comments

Comments
 (0)