From 1140d72f422db7bc60bf33d6c9f301e273f425e7 Mon Sep 17 00:00:00 2001 From: Noah Spannbauer Date: Thu, 1 May 2025 19:18:17 -0500 Subject: [PATCH 1/3] reverting to app on container app --- .github/workflows/app_build.yaml | 70 ++++++++++++++++++ .github/workflows/app_build_deploy.yaml | 73 ------------------- .../{api_deploy.yaml => deploy.yaml} | 1 - .github/workflows/main.yaml | 20 ++++- .github/workflows/pull_request.yaml | 3 +- .github/workflows/tag.yaml | 20 ++++- api/README.md | 73 ------------------- app/README.md | 1 + 8 files changed, 105 insertions(+), 156 deletions(-) create mode 100644 .github/workflows/app_build.yaml delete mode 100644 .github/workflows/app_build_deploy.yaml rename .github/workflows/{api_deploy.yaml => deploy.yaml} (99%) diff --git a/.github/workflows/app_build.yaml b/.github/workflows/app_build.yaml new file mode 100644 index 0000000..ac0900a --- /dev/null +++ b/.github/workflows/app_build.yaml @@ -0,0 +1,70 @@ +name: 'App Build' +on: + workflow_call: + inputs: + environment_name: + required: true + type: string + version_number: + required: true + type: string + +env: + VITE_API_URL: ${{ vars.VITE_API_URL }} + VITE_CLIENT_ID: ${{ vars.VITE_CLIENT_ID }} + VITE_TENANT_ID: ${{ vars.VITE_TENANT_ID }} + VITE_REDIRECT_URL: ${{ vars.VITE_REDIRECT_URL }} + +jobs: + build: + runs-on: ubuntu-latest + environment: ${{ inputs.environment_name }} + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: | + app + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 10 + run_install: false + + - name: 'Setup Node' + uses: actions/setup-node@v4 + with: + node-version: ${{ vars.NODE_VERSION }} + + - name: Install + run: | + pnpm install + + - name: Build + run: | + pnpm --filter app build + + - name: Deploy + if: ${{ github.event_name != 'pull_request' }} + run: | + pnpm --filter app --prod deploy ./.prod/app + + - name: Setup Docker Buildx + if: ${{ github.event_name != 'pull_request' }} + uses: docker/setup-buildx-action@v3 + + - name: Log into Docker Hub + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push to registry + if: ${{ github.event_name != 'pull_request' }} + uses: docker/build-push-action@v6 + with: + push: true + tags: noahspan/root-app:${{ inputs.version_number }} + context: . + target: app diff --git a/.github/workflows/app_build_deploy.yaml b/.github/workflows/app_build_deploy.yaml deleted file mode 100644 index 7fe7324..0000000 --- a/.github/workflows/app_build_deploy.yaml +++ /dev/null @@ -1,73 +0,0 @@ -name: 'App Build' -on: - workflow_call: - inputs: - environment_name: - required: true - type: string - -env: - VITE_API_URL: ${{ vars.VITE_API_URL }} - VITE_CLIENT_ID: ${{ vars.VITE_CLIENT_ID }} - VITE_TENANT_ID: ${{ vars.VITE_TENANT_ID }} - VITE_REDIRECT_URL: ${{ vars.VITE_REDIRECT_URL }} - -permissions: - id-token: write - contents: read - -jobs: - build: - runs-on: ubuntu-latest - environment: ${{ inputs.environment_name }} - steps: - - uses: actions/checkout@v4 - with: - sparse-checkout: | - app - - - uses: pnpm/action-setup@v4 - name: Install pnpm - with: - version: 10 - run_install: false - - - name: 'Setup Node' - uses: actions/setup-node@v4 - with: - node-version: ${{ vars.NODE_VERSION }} - - - name: Install - run: | - pnpm install - - - name: Build - run: | - pnpm --filter app build - - - name: Deploy - if: ${{ inputs.environment_name != 'pull_request' }} - uses: azure/login@v2 - with: - client-id: ${{ vars.VITE_CLIENT_ID }} - tenant-id: ${{ vars.VITE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - - name: Upload - if: ${{ inputs.environment_name != 'pull_request' }} - uses: azure/CLI@v1 - with: - inlineScript: | - az storage blob upload-batch --account-name ${{ vars.AZURE_STORAGE_ACCOUNT_NAME }} --auth-mode key -d '$web' -s ./app/dist --overwrite true - - # - name: Purge CDN endpoint - # if: ${{ inputs.environment_name != 'pull_request' }} - # uses: azure/CLI@v1 - # with: - # inlineScript: | - # az cdn endpoint purge --content-paths "/*" --profile-name "CDN_PROFILE_NAME" --name "CDN_ENDPOINT" --resource-group "RESOURCE_GROUP" - - - name: Azure CLI logout - if: ${{ inputs.environment_name != 'pull_request' }} - run: | - az logout diff --git a/.github/workflows/api_deploy.yaml b/.github/workflows/deploy.yaml similarity index 99% rename from .github/workflows/api_deploy.yaml rename to .github/workflows/deploy.yaml index c5b9964..6aaa6e2 100644 --- a/.github/workflows/api_deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -15,7 +15,6 @@ on: permissions: id-token: write contents: read - jobs: deploy: runs-on: ubuntu-latest diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index bf29127..6334a70 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -24,20 +24,32 @@ jobs: needs: - changes - build-api - uses: ./.github/workflows/api_deploy.yaml + uses: ./.github/workflows/deploy.yaml with: app_name: root-api environment_name: test version_number: ${{ github.run_id }} secrets: inherit - build-deploy-app: + build-app: if: ${{ needs.changes.outputs.app == 'true' }} - name: build-deploy-app + name: build-app needs: - changes - uses: ./.github/workflows/app_build_deploy.yaml + uses: ./.github/workflows/app_build.yaml with: environment_name: test + version_number: ${{ github.run_id }} secrets: inherit + deploy-app: + name: deploy-app + needs: + - changes + - build-app + uses: ./.github/workflows/deploy.yaml + with: + app_name: root-app + environment_name: test + version_number: ${{ github.run_id }} + secrets: inherit diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 20c00d0..3de7e68 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -23,7 +23,8 @@ jobs: name: build-app needs: - changes - uses: ./.github/workflows/app_build_deploy.yaml + uses: ./.github/workflows/app_build.yaml with: environment_name: pull_request + version_number: ${{ github.run_id }} secrets: inherit diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index ae40751..0d0c29a 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -17,16 +17,28 @@ jobs: name: deploy-api needs: - build-api - uses: ./.github/workflows/api_deploy.yaml + uses: ./.github/workflows/deploy.yaml with: app_name: root-api environment_name: prod version_number: ${{ github.ref_name }} secrets: inherit - build-deploy-app: - name: build-deploy-app - uses: ./.github/workflows/app_build_deploy.yaml + build-app: + name: build-app + uses: ./.github/workflows/app_build.yaml with: environment_name: prod + version_number: ${{ github.ref_name }} + secrets: inherit + + deploy-app: + name: deploy-app + needs: + - build-app + uses: ./.github/workflows/deploy.yaml + with: + app_name: root-app + environment_name: prod + version_number: ${{ github.ref_name }} secrets: inherit diff --git a/api/README.md b/api/README.md index 00a13b1..e69de29 100644 --- a/api/README.md +++ b/api/README.md @@ -1,73 +0,0 @@ -

- Nest Logo -

- -[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 -[circleci-url]: https://circleci.com/gh/nestjs/nest - -

A progressive Node.js framework for building efficient and scalable server-side applications.

-

-NPM Version -Package License -NPM Downloads -CircleCI -Coverage -Discord -Backers on Open Collective -Sponsors on Open Collective - - Support us - -

- - -## Description - -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. - -## Installation - -```bash -$ npm install -``` - -## Running the app - -```bash -# development -$ npm run start - -# watch mode -$ npm run start:dev - -# production mode -$ npm run start:prod -``` - -## Test - -```bash -# unit tests -$ npm run test - -# e2e tests -$ npm run test:e2e - -# test coverage -$ npm run test:cov -``` - -## Support - -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). - -## Stay in touch - -- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) - -## License - -Nest is [MIT licensed](LICENSE). diff --git a/app/README.md b/app/README.md index e69de29..fafd85d 100644 --- a/app/README.md +++ b/app/README.md @@ -0,0 +1 @@ +# APP \ No newline at end of file -- 2.49.1 From c75b3e28da237869ae06fb88d257e74209be2993 Mon Sep 17 00:00:00 2001 From: noahspannbauer Date: Thu, 1 May 2025 19:20:22 -0500 Subject: [PATCH 2/3] reverting to app on container app (#21) --- .github/workflows/app_build.yaml | 70 ++++++++++++++++++ .github/workflows/app_build_deploy.yaml | 73 ------------------- .../{api_deploy.yaml => deploy.yaml} | 1 - .github/workflows/main.yaml | 20 ++++- .github/workflows/pull_request.yaml | 3 +- .github/workflows/tag.yaml | 20 ++++- api/README.md | 73 ------------------- app/README.md | 1 + 8 files changed, 105 insertions(+), 156 deletions(-) create mode 100644 .github/workflows/app_build.yaml delete mode 100644 .github/workflows/app_build_deploy.yaml rename .github/workflows/{api_deploy.yaml => deploy.yaml} (99%) diff --git a/.github/workflows/app_build.yaml b/.github/workflows/app_build.yaml new file mode 100644 index 0000000..ac0900a --- /dev/null +++ b/.github/workflows/app_build.yaml @@ -0,0 +1,70 @@ +name: 'App Build' +on: + workflow_call: + inputs: + environment_name: + required: true + type: string + version_number: + required: true + type: string + +env: + VITE_API_URL: ${{ vars.VITE_API_URL }} + VITE_CLIENT_ID: ${{ vars.VITE_CLIENT_ID }} + VITE_TENANT_ID: ${{ vars.VITE_TENANT_ID }} + VITE_REDIRECT_URL: ${{ vars.VITE_REDIRECT_URL }} + +jobs: + build: + runs-on: ubuntu-latest + environment: ${{ inputs.environment_name }} + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: | + app + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 10 + run_install: false + + - name: 'Setup Node' + uses: actions/setup-node@v4 + with: + node-version: ${{ vars.NODE_VERSION }} + + - name: Install + run: | + pnpm install + + - name: Build + run: | + pnpm --filter app build + + - name: Deploy + if: ${{ github.event_name != 'pull_request' }} + run: | + pnpm --filter app --prod deploy ./.prod/app + + - name: Setup Docker Buildx + if: ${{ github.event_name != 'pull_request' }} + uses: docker/setup-buildx-action@v3 + + - name: Log into Docker Hub + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push to registry + if: ${{ github.event_name != 'pull_request' }} + uses: docker/build-push-action@v6 + with: + push: true + tags: noahspan/root-app:${{ inputs.version_number }} + context: . + target: app diff --git a/.github/workflows/app_build_deploy.yaml b/.github/workflows/app_build_deploy.yaml deleted file mode 100644 index 7fe7324..0000000 --- a/.github/workflows/app_build_deploy.yaml +++ /dev/null @@ -1,73 +0,0 @@ -name: 'App Build' -on: - workflow_call: - inputs: - environment_name: - required: true - type: string - -env: - VITE_API_URL: ${{ vars.VITE_API_URL }} - VITE_CLIENT_ID: ${{ vars.VITE_CLIENT_ID }} - VITE_TENANT_ID: ${{ vars.VITE_TENANT_ID }} - VITE_REDIRECT_URL: ${{ vars.VITE_REDIRECT_URL }} - -permissions: - id-token: write - contents: read - -jobs: - build: - runs-on: ubuntu-latest - environment: ${{ inputs.environment_name }} - steps: - - uses: actions/checkout@v4 - with: - sparse-checkout: | - app - - - uses: pnpm/action-setup@v4 - name: Install pnpm - with: - version: 10 - run_install: false - - - name: 'Setup Node' - uses: actions/setup-node@v4 - with: - node-version: ${{ vars.NODE_VERSION }} - - - name: Install - run: | - pnpm install - - - name: Build - run: | - pnpm --filter app build - - - name: Deploy - if: ${{ inputs.environment_name != 'pull_request' }} - uses: azure/login@v2 - with: - client-id: ${{ vars.VITE_CLIENT_ID }} - tenant-id: ${{ vars.VITE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - - name: Upload - if: ${{ inputs.environment_name != 'pull_request' }} - uses: azure/CLI@v1 - with: - inlineScript: | - az storage blob upload-batch --account-name ${{ vars.AZURE_STORAGE_ACCOUNT_NAME }} --auth-mode key -d '$web' -s ./app/dist --overwrite true - - # - name: Purge CDN endpoint - # if: ${{ inputs.environment_name != 'pull_request' }} - # uses: azure/CLI@v1 - # with: - # inlineScript: | - # az cdn endpoint purge --content-paths "/*" --profile-name "CDN_PROFILE_NAME" --name "CDN_ENDPOINT" --resource-group "RESOURCE_GROUP" - - - name: Azure CLI logout - if: ${{ inputs.environment_name != 'pull_request' }} - run: | - az logout diff --git a/.github/workflows/api_deploy.yaml b/.github/workflows/deploy.yaml similarity index 99% rename from .github/workflows/api_deploy.yaml rename to .github/workflows/deploy.yaml index c5b9964..6aaa6e2 100644 --- a/.github/workflows/api_deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -15,7 +15,6 @@ on: permissions: id-token: write contents: read - jobs: deploy: runs-on: ubuntu-latest diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index bf29127..6334a70 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -24,20 +24,32 @@ jobs: needs: - changes - build-api - uses: ./.github/workflows/api_deploy.yaml + uses: ./.github/workflows/deploy.yaml with: app_name: root-api environment_name: test version_number: ${{ github.run_id }} secrets: inherit - build-deploy-app: + build-app: if: ${{ needs.changes.outputs.app == 'true' }} - name: build-deploy-app + name: build-app needs: - changes - uses: ./.github/workflows/app_build_deploy.yaml + uses: ./.github/workflows/app_build.yaml with: environment_name: test + version_number: ${{ github.run_id }} secrets: inherit + deploy-app: + name: deploy-app + needs: + - changes + - build-app + uses: ./.github/workflows/deploy.yaml + with: + app_name: root-app + environment_name: test + version_number: ${{ github.run_id }} + secrets: inherit diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 20c00d0..3de7e68 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -23,7 +23,8 @@ jobs: name: build-app needs: - changes - uses: ./.github/workflows/app_build_deploy.yaml + uses: ./.github/workflows/app_build.yaml with: environment_name: pull_request + version_number: ${{ github.run_id }} secrets: inherit diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index ae40751..0d0c29a 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -17,16 +17,28 @@ jobs: name: deploy-api needs: - build-api - uses: ./.github/workflows/api_deploy.yaml + uses: ./.github/workflows/deploy.yaml with: app_name: root-api environment_name: prod version_number: ${{ github.ref_name }} secrets: inherit - build-deploy-app: - name: build-deploy-app - uses: ./.github/workflows/app_build_deploy.yaml + build-app: + name: build-app + uses: ./.github/workflows/app_build.yaml with: environment_name: prod + version_number: ${{ github.ref_name }} + secrets: inherit + + deploy-app: + name: deploy-app + needs: + - build-app + uses: ./.github/workflows/deploy.yaml + with: + app_name: root-app + environment_name: prod + version_number: ${{ github.ref_name }} secrets: inherit diff --git a/api/README.md b/api/README.md index 00a13b1..e69de29 100644 --- a/api/README.md +++ b/api/README.md @@ -1,73 +0,0 @@ -

- Nest Logo -

- -[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 -[circleci-url]: https://circleci.com/gh/nestjs/nest - -

A progressive Node.js framework for building efficient and scalable server-side applications.

-

-NPM Version -Package License -NPM Downloads -CircleCI -Coverage -Discord -Backers on Open Collective -Sponsors on Open Collective - - Support us - -

- - -## Description - -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. - -## Installation - -```bash -$ npm install -``` - -## Running the app - -```bash -# development -$ npm run start - -# watch mode -$ npm run start:dev - -# production mode -$ npm run start:prod -``` - -## Test - -```bash -# unit tests -$ npm run test - -# e2e tests -$ npm run test:e2e - -# test coverage -$ npm run test:cov -``` - -## Support - -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). - -## Stay in touch - -- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) - -## License - -Nest is [MIT licensed](LICENSE). diff --git a/app/README.md b/app/README.md index e69de29..fafd85d 100644 --- a/app/README.md +++ b/app/README.md @@ -0,0 +1 @@ +# APP \ No newline at end of file -- 2.49.1 From a84c0d2c3d083a1c8fdcc791275604d90244a03c Mon Sep 17 00:00:00 2001 From: Noah Spannbauer Date: Thu, 1 May 2025 19:32:41 -0500 Subject: [PATCH 3/3] reverting to app on container app --- app/src/components/projects/Projects.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/components/projects/Projects.tsx b/app/src/components/projects/Projects.tsx index 8b3268e..37ff05d 100644 --- a/app/src/components/projects/Projects.tsx +++ b/app/src/components/projects/Projects.tsx @@ -38,8 +38,8 @@ const Projects = () => { `api/projects`, ); const projects: Project[] = response.data; - console.log(projects); - projects.sort((a, b) => Number(a.order) - Number(b.order)) + + projects.sort((a, b) => Number(a.order) - Number(b.order)); return projects; } catch (error) { @@ -126,7 +126,15 @@ const Projects = () => { dispatch({ type: 'SET_IS_LOADING', payload: true }) const projects = await getProjects(); - dispatch({ type: 'SET_PROJECTS', payload: projects }) + if (projects.length > 0) { + dispatch({ type: 'SET_PROJECTS', payload: projects }); + + if (state.alert) { + dispatch({ type: 'SET_ALERT', payload: undefined }) + } + } else { + dispatch({ type: 'SET_ALERT', payload: { severity: 'info', message: 'No projects found.'}}); + } } catch (error) { dispatch({ type: 'SET_ALERT', -- 2.49.1