-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add deployment + package workflows for API and Web App
- Added new workflow files `build-package-api.yml` and `build-package-web.yml` - Workflows trigger on a workflow call with a required input parameter - Workflows have necessary permissions to read contents and packages - Build API (prod) job in `build-package-api.yml`: - Checks out the code repository - Sets up .NET environment - Builds the .NET project using the specified build configuration - Packages the API using the specified build configuration - Uploads artifacts to be used later - Build Web App job in `build-package-web.yml`: - Checks out the code repository - Sets up Node.js environment - Installs Angular CLI globally - Installs dependencies for the app - Builds the Angular app using the specified build configuration - Uploads artifacts to be used later
- Loading branch information
1 parent
b92e292
commit e0e9e4c
Showing
8 changed files
with
206 additions
and
4 deletions.
There are no files selected for viewing
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,41 @@ | ||
name: Build & Package API | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
build_configuration: | ||
description: 'Build Configuration' | ||
type: string | ||
required: true | ||
|
||
permissions: | ||
contents: read | ||
packages: read | ||
|
||
jobs: | ||
# Build prod | ||
build-api-prod: | ||
name: Build API (prod) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: '8.0.x' | ||
# include-prerelease: true | ||
|
||
- name: Build .NET project (prod) | ||
run: dotnet build --configuration ${{ inputs.build_configuration }} | ||
|
||
- name: Package API (prod) | ||
run: dotnet publish --configuration ${{ inputs.build_configuration }} --output ./publish | ||
|
||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wowskarma_api | ||
path: ./publish |
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,43 @@ | ||
name: Build & Package Web App | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
build_configuration: | ||
description: 'Build Configuration' | ||
type: string | ||
required: true | ||
|
||
permissions: | ||
contents: read | ||
packages: read | ||
|
||
jobs: | ||
# Build angular app | ||
build-web: | ||
name: Build Web App | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
|
||
- name: Install Angular CLI | ||
run: npm install -g @angular/cli | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build Angular app | ||
run: ng build --configuration=${{ inputs.build_configuration }} | ||
|
||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wowskarma_app | ||
path: ./dist |
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,66 @@ | ||
name: deploy-preview.yml | ||
|
||
on: | ||
push: | ||
branches: [ develop ] | ||
|
||
permissions: | ||
contents: read | ||
packages: read | ||
deployments: write | ||
|
||
jobs: | ||
# First: Make sure dev build ran fine. | ||
build-test-solution: | ||
name: Build & Test Solution | ||
uses: ./.github/workflows/dotnet-build.yml | ||
|
||
# Build & Package API & Web from 'build-package-api.yml' and 'build-package-web.yml'. | ||
build-package-api: | ||
name: Build & Package API | ||
needs: build-test-solution | ||
uses: ./.github/workflows/build-package-api.yml | ||
with: | ||
build_configuration: 'Preview' | ||
|
||
build-package-web: | ||
name: Build & Package Web App | ||
needs: build-test-solution | ||
uses: ./.github/workflows/build-package-web.yml | ||
with: | ||
build_configuration: 'Preview' | ||
|
||
# Deploy to server | ||
deploy-preview: | ||
name: Deploy Preview to server | ||
environment: | ||
name: preview | ||
url: https://preview.wows-karma.com/ | ||
needs: | ||
- build-package-api | ||
- build-package-web | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download packaged API artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: wowskarma_api | ||
path: ./api | ||
|
||
- name: Download packaged Web App artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: wowskarma_app | ||
path: ./web | ||
|
||
- name: Install SSH Key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: ${{ secrets.SSH_PRIVATEKEY }} | ||
known_hosts: '*.nodsoft.net' | ||
|
||
- name: Add Known Hosts | ||
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | ||
|
||
- name: Deploy with rsync | ||
run: rsync -avz . ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_DEPLOYPATH }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export const environment = { | ||
name: "preview", | ||
|
||
apiHost: { | ||
EU: "https://api.preview.wows-karma.com", | ||
NA: "https://api.preview.wows-karma.com", | ||
CIS: "https://api.preview.wows-karma.com", | ||
SEA: "https://api.preview.wows-karma.com", | ||
}, | ||
|
||
applicationInsights: { | ||
connectionString: "InstrumentationKey=3fab5b95-b531-4f15-95e9-83f31e2ed531;IngestionEndpoint=https://francecentral-1.in.applicationinsights.azure.com/;LiveEndpoint=https://francecentral.livediagnostics.monitor.azure.com/", | ||
}, | ||
|
||
cookies: { | ||
domain: "localhost", | ||
|
||
name: { | ||
EU: "Auth_EU", | ||
NA: "Auth_NA", | ||
CIS: "Auth_CIS", | ||
SEA: "Auth_SEA", | ||
}, | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export const environment = { | ||
production: true, | ||
name: "production", | ||
|
||
apiHost: { | ||
EU: "https://api.wows-karma.com", | ||
|
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