-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ea5d13
commit 0b4af9b
Showing
1 changed file
with
92 additions
and
0 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,92 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: CI | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the "main" branch | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
env: | ||
PROJECT_NAME: utilplex | ||
|
||
jobs: | ||
build: | ||
name: Build and test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/setup@v0.9.7 | ||
with: | ||
versionSpec: "5.x" | ||
- name: Determine Version | ||
id: gitversion | ||
uses: gittools/actions/gitversion/execute@v0.9.7 | ||
with: | ||
useConfigFile: true | ||
- name: Update version in package.json | ||
run: | | ||
sed -i "s/0.0.1/$GITVERSION_SEMVER/g" package.json | ||
- name: Use Node 18.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "18.x" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Build | ||
run: ng build --configuration production | ||
- name: Archive build | ||
if: success() | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: deploy_dist | ||
path: dist | ||
- name: Archive code coverage result | ||
if: success() | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: deploy_coverage | ||
path: coverage | ||
deploy: | ||
name: Deploy to Azure | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
- name: Download build | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: deploy_dist | ||
- name: Delete blob storage | ||
uses: azure/CLI@v1 | ||
with: | ||
inlineScript: | | ||
az storage blob delete-batch --source '$web' --account-name $STORAGE_ACCOUNT_NAME | ||
- name: Upload to blob storage | ||
uses: azure/CLI@v1 | ||
with: | ||
inlineScript: | | ||
az storage blob upload-batch --account-name $STORAGE_ACCOUNT_NAME --auth-mode key -d '$web' -s ./deploy_dist/$PROJECT_NAME --overwrite | ||
- name: Change index.html content-cache-control header | ||
uses: azure/CLI@v1 | ||
with: | ||
inlineScript: | | ||
az storage blob update --account-name $STORAGE_ACCOUNT_NAME --container-name '$web' --name 'index.html' --content-cache-control 'no-cache' | ||
- name: logout | ||
run: | | ||
az logout | ||
if: always() |