-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Migrate to GitHub Actions (#300)
- Loading branch information
1 parent
2c3bb50
commit 048b044
Showing
5 changed files
with
225 additions
and
118 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: "Build" | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build-backend: | ||
name: "Backend" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install .NET SDK | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: "8.x" | ||
dotnet-quality: "ga" | ||
|
||
- name: Build .NET solution | ||
run: > | ||
dotnet build Server/ChartBackend.sln | ||
--configuration Release | ||
--property:ContinuousIntegrationBuild=true | ||
-warnAsError | ||
build-website: | ||
name: "Website" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
cache-dependency-path: Client/package-lock.json | ||
|
||
- name: Install packages | ||
working-directory: ./Client | ||
run: npm install | ||
|
||
- name: Build site | ||
working-directory: ./Client | ||
run: npm run build.prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
name: Deploy website | ||
|
||
on: [ workflow_dispatch ] | ||
|
||
concurrency: | ||
group: website-deployer | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-backend: | ||
runs-on: windows-latest | ||
|
||
env: | ||
url: https://charts.stockindicators.dev | ||
|
||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install .NET SDK | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: "8.x" | ||
dotnet-quality: "ga" | ||
|
||
- name: Update configs | ||
shell: pwsh | ||
working-directory: Server/WebApi | ||
run: | | ||
Copy-Item "appsettings.Token.json" -Destination "appsettings.json" -Force | ||
Remove-Item "appsettings.Token.json" -Force | ||
(Get-Content appsettings.json).Replace("__Website__", "${{ env.url }}") | Set-Content appsettings.json | ||
Write-Host "... Done!" | ||
- name: Build .NET solution | ||
run: > | ||
dotnet build Server/ChartBackend.sln | ||
--configuration Release | ||
--property:ContinuousIntegrationBuild=true | ||
-warnAsError | ||
- name: Package Web API | ||
working-directory: Server | ||
run: > | ||
dotnet publish WebApi/WebApi.csproj | ||
--configuration Release | ||
--property:PublishDir="../artifacts/api" | ||
- name: Package Functions | ||
working-directory: Server | ||
run: > | ||
dotnet publish Functions/Functions.csproj | ||
--configuration Release | ||
--property:PublishDir="../artifacts/fns" | ||
- name: Save Web API | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: api | ||
path: "./Server/artifacts/api" | ||
|
||
- name: Save Functions | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: fns | ||
path: "./Server/artifacts/fns" | ||
|
||
build-website: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
cache-dependency-path: Client/package-lock.json | ||
|
||
- name: Install packages | ||
working-directory: Client | ||
run: npm install | ||
|
||
- name: Update configs | ||
shell: pwsh | ||
working-directory: Client/src | ||
run: | | ||
(Get-Content index.html).Replace("__GaTag__", "G-17DX6ZW6HP") | Set-Content index.html | ||
Write-Host "... Done!" | ||
- name: Build site | ||
working-directory: Client | ||
run: npm run build.prod | ||
|
||
- name: Store artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: web | ||
path: Client/dist/app | ||
|
||
deploy: | ||
needs: [ "build-backend", "build-website" ] | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: website | ||
url: "https://charts.stockindicators.dev" | ||
|
||
steps: | ||
|
||
- name: Download Functions package | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: fns | ||
path: artifacts/fns | ||
|
||
- name: Show Functions artifacts | ||
working-directory: artifacts/fns | ||
run: ls | ||
|
||
- name: Download API package | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: api | ||
path: artifacts/api | ||
|
||
- name: Show API artifacts | ||
working-directory: artifacts/api | ||
run: ls | ||
|
||
- name: Download Web package | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: web | ||
path: artifacts/web | ||
|
||
- name: Show Web artifacts | ||
working-directory: artifacts/web | ||
run: ls | ||
|
||
- name: Deploy Functions | ||
uses: Azure/functions-action@v1 | ||
with: | ||
app-name: stock-charts-functions | ||
package: artifacts/fns | ||
publish-profile: ${{ secrets.PUBLISH_PROFILE_FNS }} | ||
|
||
- name: Deploy API | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: stock-charts-api | ||
package: artifacts/api | ||
publish-profile: ${{ secrets.PUBLISH_PROFILE_API }} | ||
|
||
- name: Deploy website | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: stock-charts | ||
package: artifacts/web | ||
publish-profile: ${{ secrets.PUBLISH_PROFILE_WEB }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters