Feature/32 deploy api as azure function app (#34)
* changing api to azure function app * changing api to azure function app * changing api to azure function app * changing api to azure function app * changing api to azure function app * changing api to azure function app * changing api to azure container app
This commit was merged in pull request #34.
This commit is contained in:
62
.github/workflows/api.yaml
vendored
Normal file
62
.github/workflows/api.yaml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: 'API Build and Deploy'
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
calling_workflow:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ inputs.calling_workflow }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: 'Setup Node'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ vars.NODE_VERSION }}
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
npm install
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
npm run build -w api
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log into Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push to registry
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
tags: noahspan/flying-api:${{ github.run_id }}
|
||||
file: ./api/Dockerfile
|
||||
context: ./api
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ inputs.calling_workflow }}
|
||||
needs: build
|
||||
steps:
|
||||
- name: Log in to Azure
|
||||
uses: azure/login@v2
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
|
||||
- name: Update Container App
|
||||
run: |
|
||||
az container app update --name flying-api --resource-group noahspan --image noahspan-flying:${{ github.run_id }}
|
||||
48
.github/workflows/app.yaml
vendored
Normal file
48
.github/workflows/app.yaml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
name: 'App Build and Deploy'
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
calling_workflow:
|
||||
required: true
|
||||
type: string
|
||||
deployment_environment:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ inputs.calling_workflow }}
|
||||
env:
|
||||
VITE_API_URL: ${{ secrets.VITE_API_URL }}
|
||||
VITE_CLIENT_ID: ${{ secrets.VITE_CLIENT_ID }}
|
||||
VITE_TENANT_ID: ${{ secrets.VITE_TENANT_ID }}
|
||||
VITE_REDIRECT_URL: ${{ secrets.VITE_REDIRECT_URL }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: 'Setup Node'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ vars.NODE_VERSION }}
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
npm install
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
npm run build -w app
|
||||
|
||||
- name: Deploy
|
||||
id: builddeploy
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
action: 'upload'
|
||||
skip_app_build: true
|
||||
app_location: ${{ vars.APP_LOCATION }}
|
||||
deployment_environment: ${{ inputs.deployment_environment }}
|
||||
21
.github/workflows/dev.yaml
vendored
Normal file
21
.github/workflows/dev.yaml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Dev
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- feature/**
|
||||
|
||||
jobs:
|
||||
build-deploy-api:
|
||||
name: build-deploy-api
|
||||
uses: ./.github/workflows/api.yaml
|
||||
with:
|
||||
calling_workflow: dev
|
||||
secrets: inherit
|
||||
|
||||
build-deploy-app:
|
||||
name: build-deploy-app
|
||||
uses: ./.github/workflows/app.yaml
|
||||
with:
|
||||
calling_workflow: dev
|
||||
deployment_environment: development
|
||||
secrets: inherit
|
||||
43
.github/workflows/feature.yml
vendored
43
.github/workflows/feature.yml
vendored
@@ -1,43 +0,0 @@
|
||||
name: Feature
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- feature/**
|
||||
|
||||
env:
|
||||
VITE_CLIENT_ID: ${{ vars.VITE_CLIENT_ID }}
|
||||
VITE_TENANT_ID: ${{ vars.VITE_TENANT_ID }}
|
||||
VITE_REDIRECT_URL: ${{ vars.VITE_REDIRECT_URL }}
|
||||
|
||||
jobs:
|
||||
build_and_deploy_job:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build and Deploy Job
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
npm install
|
||||
|
||||
- name: Build API
|
||||
run: |
|
||||
npm run build -w api
|
||||
|
||||
- name: Build and Deploy
|
||||
id: builddeploy
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
action: 'upload'
|
||||
app_build_command: ${{ vars.APP_BUILD_COMMAND }}
|
||||
app_location: ${{ vars.APP_LOCATION }}
|
||||
# api_build_command: ${{ vars.API_BUILD_COMMAND }}
|
||||
api_location: ${{ vars.API_LOCATION }}
|
||||
output_location: ${{ vars.OUTPUT_LOCATION }}
|
||||
deployment_environment: 'development'
|
||||
skip_api_build: true
|
||||
37
.github/workflows/pull_request.yaml
vendored
Normal file
37
.github/workflows/pull_request.yaml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-deploy-api:
|
||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
||||
name: build-deploy-api
|
||||
uses: ./.github/workflows/api.yaml
|
||||
with:
|
||||
calling_workflow: dev
|
||||
secrets: inherit
|
||||
|
||||
build-deploy-app:
|
||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
||||
name: build-deploy-app
|
||||
uses: ./.github/workflows/app.yaml
|
||||
with:
|
||||
calling_workflow: dev
|
||||
deployment_environment: staging
|
||||
secrets: inherit
|
||||
|
||||
close-pull-request-job:
|
||||
if: github.event_name == 'pull_request' && github.event.action == 'closed'
|
||||
runs-on: ubuntu-latest
|
||||
name: Close Pull Request Job
|
||||
steps:
|
||||
- name: Close Pull Request
|
||||
id: closepullrequest
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
|
||||
action: 'close'
|
||||
43
.github/workflows/pull_request.yml
vendored
43
.github/workflows/pull_request.yml
vendored
@@ -1,43 +0,0 @@
|
||||
name: Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build_and_deploy_job:
|
||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
||||
runs-on: ubuntu-latest
|
||||
name: Build and Deploy Job
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
lfs: false
|
||||
- name: Build And Deploy
|
||||
id: builddeploy
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
action: 'upload'
|
||||
app_build_command: ${{ vars.APP_BUILD_COMMAND }}
|
||||
app_location: ${{ vars.APP_LOCATION }}
|
||||
api_build_command: ${{ vars.API_BUILD_COMMAND }}
|
||||
api_location: ${{ vars.API_LOCATION}}
|
||||
output_location: ${{ vars.OUTPUT_LOCATION }}
|
||||
deployment_environment: 'staging'
|
||||
|
||||
close_pull_request_job:
|
||||
if: github.event_name == 'pull_request' && github.event.action == 'closed'
|
||||
runs-on: ubuntu-latest
|
||||
name: Close Pull Request Job
|
||||
steps:
|
||||
- name: Close Pull Request
|
||||
id: closepullrequest
|
||||
uses: Azure/static-web-apps-deploy@v1
|
||||
with:
|
||||
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
|
||||
action: 'close'
|
||||
Reference in New Issue
Block a user