72 lines
1.9 KiB
YAML
72 lines
1.9 KiB
YAML
name: 'App Build and Deploy'
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
calling_workflow:
|
|
required: true
|
|
type: string
|
|
version_number:
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
environment: ${{ inputs.calling_workflow }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: |
|
|
app
|
|
|
|
- name: 'Setup Node'
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ vars.NODE_VERSION }}
|
|
|
|
- name: Install
|
|
working-directory: app
|
|
run: |
|
|
npm install
|
|
|
|
- name: Build
|
|
working-directory: app
|
|
run: |
|
|
npm run build
|
|
|
|
- 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.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push to registry
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: true
|
|
tags: noahspan/flying-app:${{ inputs.version_number }}
|
|
file: ./app/Dockerfile
|
|
context: ./app
|
|
build-args: |
|
|
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 }}
|
|
|
|
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 containerapp update --name flying-app-${{ inputs.calling_workflow }} --revision-suffix ${{ inputs.version_number }} --resource-group noahspan --image docker.io/noahspan/flying-app:${{ inputs.version_number }}
|