Skip to content

feat(upload,large-file-upload): add authorization and file schema #13

feat(upload,large-file-upload): add authorization and file schema

feat(upload,large-file-upload): add authorization and file schema #13

name: Docker Build Staging
on:
push:
branches-ignore:
- main
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate Matrix
id: set-matrix
run: |
apps=$(ls -d apps/*/)
matrix="{\"include\":["
for app in $apps; do
app_name=$(basename $app)
matrix="${matrix}{\"app-dir\":\"${app_name}\",\"app-package-name\":\"@npcs/${app_name}\",\"image-name\":\"ghcr.io/${{ github.actor }}/npcs-${app_name}:staging\"},"
done
matrix="${matrix%?}]}"
echo "::set-output name=matrix::${matrix}"
build:
needs: generate-matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Login Registry
if: github.ref == 'refs/heads/develop'
run: |
echo ${{ secrets.PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build Docker Image
id: docker_build
uses: docker/build-push-action@v6
with:
push: ${{ github.ref == 'refs/heads/develop' && 'true' || 'false' }}
tags: ${{ matrix.image-name }}
cache-from: type=registry,ref=${{ matrix.image-name }}
cache-to: type=inline
context: .
file: ${{ secrets.DOCKERFILE }}
build-args: |
TURBO_TEAM=${{ secrets.TURBO_TEAM }}
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
APP_DIR=apps/${{ matrix.app-dir }}
APP_PACKAGE_NAME=${{ matrix.app-package-name }}
- run: |
echo "Docker Image ID: ${{ steps.docker_build.outputs.imageid }}"
echo "Docker Image digest: ${{ steps.docker_build.outputs.digest }}"
echo "Docker Image metadata: ${{ steps.docker_build.outputs.metadata }}"
- name: Trigger Deploy
if: github.ref == 'refs/heads/develop'
run: |
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PAT }}" \
-d "{\"event_type\":\"deploy_staging\",\"client_payload\":{\"app\":\"${{ matrix.app-dir }}\"}}" \
https://api.github.com/repos/${{ github.repository }}/dispatches
- name: Check Deploy Event
run: |
echo "Deploy event triggered for app: ${{ matrix.app-dir }}"