Merge pull request #81 from TomasiDeveloping/dependabot/npm_and_yarn/… #35
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
name: CI/CD for ExpenseTracker | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
backend-build: | |
runs-on: windows-latest | |
defaults: | |
run: | |
working-directory: ./Api | |
steps: | |
- name: Checkout .NET | |
uses: actions/checkout@v3 | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
include-prerelease: true | |
- name: Build .NET | |
run: dotnet build --configuration Release | |
- name: Publish .NET | |
run: dotnet publish -c Release -o "${{env.GITHUB_WORKSPACE}}\myapp" | |
- name: Upload .NET artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: .NET-Api | |
path: ${{env.GITHUB_WORKSPACE}}\myapp | |
frontend-build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./UI | |
steps: | |
- name: Ceckout Angular | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
cache: 'npm' | |
cache-dependency-path: './UI/package-lock.json' | |
- name: Install dependencies | |
run: npm install --force | |
- name: Build Angular | |
run: npm run build | |
- name: Upload Angular artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Angular-UI | |
path: ./UI/dist/ui | |
deploy-backend: | |
runs-on: windows-latest | |
needs: [backend-build, frontend-build] | |
environment: | |
name: 'production' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Download .NET artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: .NET-Api | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: 'tomasi-expense-tracker' | |
slot-name: 'production' | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE}} | |
package: . | |
deploy-frontend: | |
runs-on: ubuntu-latest | |
needs: [backend-build, frontend-build] | |
steps: | |
- name: Download Angular artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: Angular-UI | |
- name: FTP Deploy | |
uses: SamKirkland/[email protected] | |
with: | |
server: ${{ secrets.FTP_SERVER }} | |
username: ${{ secrets.FTP_USERNAME }} | |
password: ${{ secrets.FTP_PASSWORD }} | |
protocol: ftps | |
server-dir: ${{ secrets.FTP_SERVER_DIR }} | |
dangerous-clean-slate: true | |