First commit
This commit is contained in:
82
.gitea/workflows/build_and_test.yaml
Normal file
82
.gitea/workflows/build_and_test.yaml
Normal file
@@ -0,0 +1,82 @@
|
||||
name: 'API Build'
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
environment_name:
|
||||
required: true
|
||||
type: string
|
||||
version_number:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ inputs.environment_name }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
api
|
||||
client
|
||||
|
||||
- name: Get Secrets from Infisical
|
||||
uses: Infisical/secrets-action@v1.0.16
|
||||
with:
|
||||
domain: ${{ secrets.INFISICAL_DOMAIN }}
|
||||
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
||||
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
||||
project-slug: ${{ secrets.INFISICAL_PROJECT_SLUG }}
|
||||
env-slug: ${{ inputs.environment_name }}
|
||||
secret-path: /portfolio
|
||||
|
||||
- name: Install Nest CLI
|
||||
run: |
|
||||
npm install -g @nestjs/cli
|
||||
|
||||
- name: 'Setup Node'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm ci
|
||||
|
||||
- name: Build API
|
||||
run: |
|
||||
npm run build -w api
|
||||
|
||||
- name: Test API
|
||||
run: |
|
||||
npm run test -w api
|
||||
|
||||
- name: Build Client
|
||||
env:
|
||||
VITE_API_URL: ${{ env.VITE_API_URL }}
|
||||
VITE_BASE_URL: ${{ env.VITE_BASE_URL }}
|
||||
VITE_CLIENT_ID: ${{ env.VITE_CLIENT_ID }}
|
||||
VITE_ISSUER_URI: ${{ env.VITE_ISSUER_URI }}
|
||||
VITE_TENANT_ID: ${{ env.VITE_TENANT_ID }}
|
||||
run: |
|
||||
npm run build -w client
|
||||
|
||||
- name: Log into Docker Hub
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ env.DOCKERHUB_USERNAME }}
|
||||
password: ${{ env.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push to registry
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
push: true
|
||||
tags: noahspan/flying:${{ inputs.version_number }}
|
||||
context: .
|
||||
38
.gitea/workflows/changes.yaml
Normal file
38
.gitea/workflows/changes.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Changes
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
api:
|
||||
value: ${{ jobs.changes.outputs.api }}
|
||||
client:
|
||||
value: ${{ jobs.changes.outputs.client }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
name: filter
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
api: ${{ steps.filter.outputs.api }}
|
||||
client: ${{ steps.filter.outputs.client }}
|
||||
steps:
|
||||
- name: 'Setup Node'
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '22.x'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
api:
|
||||
- 'api/**'
|
||||
client:
|
||||
- 'client/**'
|
||||
infrastructure:
|
||||
- 'infrastructure/**'
|
||||
44
.gitea/workflows/deploy.yaml
Normal file
44
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
name: Deploy
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
app_name:
|
||||
required: true
|
||||
type: string
|
||||
environment_name:
|
||||
required: true
|
||||
type: string
|
||||
version_number:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ inputs.environment_name }}
|
||||
steps:
|
||||
- name: Get Secrets from Infisical
|
||||
uses: Infisical/secrets-action@v1.0.16
|
||||
with:
|
||||
domain: ${{ secrets.INFISICAL_DOMAIN }}
|
||||
client-id: ${{ secrets.INFISICAL_CLIENT_ID }}
|
||||
client-secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
|
||||
project-slug: ${{ secrets.INFISICAL_PROJECT_SLUG }}
|
||||
env-slug: ${{ inputs.environment_name }}
|
||||
secret-path: /portfolio
|
||||
|
||||
- name: Install Azure CLI
|
||||
run: |
|
||||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
||||
|
||||
- name: Log in to Azure
|
||||
run: |
|
||||
az login --service-principal --username ${{ env.AZURE_CLIENT_ID }} --password ${{ env.AZURE_CLIENT_SECRET }} --tenant ${{ env.AZURE_TENANT_ID }}
|
||||
|
||||
- name: Update Container App
|
||||
run: |
|
||||
az containerapp update --name ${{ inputs.app_name }}-${{ inputs.environment_name }} --container-name ${{ inputs.app_name }} --resource-group ${{ env.RESOURCE_GROUP }} --image docker.io/noahspan/${{ inputs.app_name }}:${{ inputs.version_number }}
|
||||
32
.gitea/workflows/main.yaml
Normal file
32
.gitea/workflows/main.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
name: Main
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
uses: ./.gitea/workflows/changes.yaml
|
||||
|
||||
build-and-test:
|
||||
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.client == 'true' }}
|
||||
name: build-and-test
|
||||
needs:
|
||||
- changes
|
||||
uses: ./.gitea/workflows/build_and_test.yaml
|
||||
with:
|
||||
environment_name: test
|
||||
version_number: ${{ github.run_id }}
|
||||
secrets: inherit
|
||||
|
||||
deploy:
|
||||
name: deploy
|
||||
needs:
|
||||
- changes
|
||||
- build-and-test
|
||||
uses: ./.gitea/workflows/deploy.yaml
|
||||
with:
|
||||
app_name: flying
|
||||
environment_name: test
|
||||
version_number: ${{ github.run_id }}
|
||||
secrets: inherit
|
||||
19
.gitea/workflows/pull_request.yaml
Normal file
19
.gitea/workflows/pull_request.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Pull Request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
uses: ./.gitea/workflows/changes.yaml
|
||||
|
||||
build:
|
||||
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.client == 'true'}}
|
||||
name: build-and-test
|
||||
needs:
|
||||
- changes
|
||||
uses: ./.gitea/workflows/build_and_test.yaml
|
||||
with:
|
||||
environment_name: test
|
||||
version_number: ${{ github.run_id }}
|
||||
secrets: inherit
|
||||
25
.gitea/workflows/tag.yaml
Normal file
25
.gitea/workflows/tag.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Tag
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
name: build-and-test
|
||||
uses: ./.gitea/workflows/build_and_test.yaml
|
||||
with:
|
||||
environment_name: prod
|
||||
version_number: ${{ github.ref_name }}
|
||||
secrets: inherit
|
||||
|
||||
deploy:
|
||||
name: deploy
|
||||
needs:
|
||||
- build-and-test
|
||||
uses: ./.gitea/workflows/deploy.yaml
|
||||
with:
|
||||
app_name: flying
|
||||
environment_name: prod
|
||||
version_number: ${{ github.ref_name }}
|
||||
secrets: inherit
|
||||
Reference in New Issue
Block a user