File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : CI/CD
2+ env : { DOTNET_NOLOGO: true }
3+ on :
4+ workflow_call :
5+ inputs :
6+ publish : { type: boolean, default: false, description: Publish application }
7+ environment : { type: string, default: dev, description: Choose publish environment <dev|staging|prod> }
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout
13+ uses : actions/checkout@v4
14+ with :
15+ fetch-depth : 0
16+ submodules : ' true'
17+
18+ - name : Read .NET Version
19+ shell : pwsh
20+ id : dotnet-version
21+ run : |
22+ $version = (Get-Content .\global.json -Raw | ConvertFrom-Json).sdk.version.TrimEnd('0') + 'x'
23+ "version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
24+
25+ - name : Setup .NET
26+ uses : actions/setup-dotnet@v4
27+ with : { dotnet-version: "${{ steps.dotnet-version.outputs.version }}" }
28+
29+ - name : Setup tools
30+ run : |
31+ dotnet workload install wasm-tools
32+ npm install -g tailwindcss
33+
34+ - name : Restore
35+ working-directory : src/TabKeeper.UI.Wasm
36+ run : |
37+ npm install
38+ dotnet restore
39+
40+ - name : Build
41+ working-directory : src/TabKeeper.UI.Wasm
42+ run : dotnet build -c Release --no-restore
43+
44+ - name : Publish
45+ if : ${{ inputs.publish }}
46+ working-directory : src/TabKeeper.UI.Wasm
47+ shell : pwsh
48+ run : |
49+ .\css.ps1 -publish
50+ dotnet publish --no-restore --no-build
51+
52+ - name : Publish to Cloudflare Pages
53+ if : ${{ inputs.publish }}
54+ uses : cloudflare/wrangler-action@v3
55+ with :
56+ apiToken : ${{ secrets.CLOUDFLARE_API_TOKEN }}
57+ accountId : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
58+ command : pages deploy artifacts/src/publish/TabKeeper.UI.Wasm/release/wwwroot --project-name=tab-keeper --branch ${{ inputs.environment }}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- name : Build
2-
3- env :
4- DOTNET_NOLOGO : true
5-
1+ name : build
2+ env : { DOTNET_NOLOGO: true }
63on :
7- workflow_dispatch :
84 pull_request :
9- branches : [main, dev]
5+ branches :
6+ - main
107 paths :
11- - " version.json"
12- - " src/**/*.cs"
13- - " src/**/*.csproj"
14-
8+ - src/**
9+ - test/**
10+ types :
11+ - opened
12+ - ready_for_review
13+ - review_requested
1514jobs :
16- Build :
17- uses : panoukos41/TabKeeper/.github/workflows/_ci .yaml@dev
15+ pipeline :
16+ uses : panoukos41/TabKeeper/.github/workflows/_ .yaml@main
Original file line number Diff line number Diff line change 1- name : Publish
2-
3- env :
4- DOTNET_NOLOGO : true
5-
1+ name : publish
2+ env : { DOTNET_NOLOGO: true }
63on :
74 workflow_dispatch :
85 push :
9- branches : [main, dev]
6+ branches :
7+ - main
8+ tags :
9+ - v[0-9]+.[0-9]+.[0-9]+ # Only matches vX.X.X where X is a number
1010 paths :
11- - " version.json"
12- - " src/**/*.cs"
13- - " src/**/*.csproj"
14-
11+ - src/**
12+ - test/**
1513jobs :
16- Build :
17- uses : panoukos41/TabKeeper/.github/workflows/_ci.yaml@dev
18- with :
19- publish : true
20- secrets : inherit
14+ pipeline :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : Determine if prod
18+ if : startsWith(github.ref, 'refs/tags/v')
19+ run : echo "environment=main" >> $GITHUB_ENV
20+
21+ - name : Determine if dev
22+ if : startsWith(github.ref, 'refs/heads/main')
23+ run : echo "environment=dev" >> $GITHUB_ENV
24+
25+ - name : Publish
26+ uses : panoukos41/TabKeeper/.github/workflows/_.yaml@main
27+ with :
28+ publish : true
29+ environment : $environment
You can’t perform that action at this time.
0 commit comments