diff --git a/.github/workflows/azure-arquitecture.yml b/.github/workflows/azure-arquitecture.yml deleted file mode 100644 index 811a304..0000000 --- a/.github/workflows/azure-arquitecture.yml +++ /dev/null @@ -1,49 +0,0 @@ -# .github/workflows/node-build.yml -name: Deploy to Azure Arquitecture - - -on: - workflow_call: - - -jobs: - deploy-azure-arquitecture: - name: Arquitecture - runs-on: ubuntu-latest - env: - ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} - ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} - ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} - ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} - GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Clone terraform scripts repository - uses: actions/checkout@v4 - with: - repository: codeparce/azure-terraform - ref: azure - token: ${{ secrets.PERSONAL_ACCES_TOKEN }} - path: azure-terraform - - - name: Setup Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.6.6 - - - name: Deploy Azure infrastructure - run: | - cd azure-terraform/2-static-web-app - bash main.sh - - - name: Upload Static Web App secrets artifact - uses: actions/upload-artifact@v4 - with: - name: static-web-app-json - path: azure-terraform/2-static-web-app/secret - retention-days: 1 diff --git a/.github/workflows/azure-web-app.yml b/.github/workflows/azure-web-app.yml deleted file mode 100644 index b543f2c..0000000 --- a/.github/workflows/azure-web-app.yml +++ /dev/null @@ -1,44 +0,0 @@ -# .github/workflows/node-build.yml -name: Deploy to Azure Arquitecture - - -on: - workflow_call: - -jobs: - deploy-azure-static-web-app: - runs-on: ubuntu-latest - name: Static Web App - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Download build artifact - uses: actions/download-artifact@v4 - with: - name: web-build - path: dist - - - name: Download json artifact - uses: actions/download-artifact@v4 - with: - name: static-web-app-json - path: secret - - - name: Install SWA CLI - run: npm install -g @azure/static-web-apps-cli - - - name: Deploy Static Web App - run: | - ENV_NAME=$([ "$GITHUB_REF_NAME" = "main" ] && echo "production" || echo "$GITHUB_REF_NAME") - FILE_JSON="secret/static-web-app-json.json" - API_KEY=$(jq -r '.properties.apiKey' $FILE_JSON) - swa deploy ./dist --deployment-token $API_KEY --env $ENV_NAME diff --git a/.github/workflows/build-functions.yml b/.github/workflows/build-functions.yml new file mode 100644 index 0000000..cc46863 --- /dev/null +++ b/.github/workflows/build-functions.yml @@ -0,0 +1,27 @@ +# .github/workflows/build-functions.yml + +on: + workflow_call: + + +jobs: + zip-code: + name: Zip Code + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: zip code + run: | + ls && cd function/ && zip -r functions.zip . -x "*test*" + + - name: Upload zip artifact + uses: actions/upload-artifact@v4 + with: + name: file.zip + path: function/functions.zip + retention-days: 1 + \ No newline at end of file diff --git a/.github/workflows/deploy-functions.yml b/.github/workflows/deploy-functions.yml new file mode 100644 index 0000000..589fea3 --- /dev/null +++ b/.github/workflows/deploy-functions.yml @@ -0,0 +1,39 @@ +# .github/workflows/deploy-functions.yml +on: + workflow_call: + +jobs: + tf-deploy: + name: Deploy GCP + runs-on: ubuntu-latest + container: + image: codeparce/ci-tools-gcloud:latest + env: + VAULT_USER: ${{ secrets.VAULT_USER }} + VAULT_PASS: ${{ secrets.VAULT_PASS }} + VAULT_ADDR: ${{ secrets.VAULT_ADDR }} + VAULT_NAMESPACE: ${{ secrets.VAULT_NAMESPACE }} + GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Download zip artifact + uses: actions/download-artifact@v4 + with: + name: file.zip + path: function + + - name: Clone terraform scripts repository + uses: actions/checkout@v4 + with: + repository: codeparceorg/terraform-cloud + ref: gcp + token: ${{ secrets.PERSONAL_ACCES_TOKEN }} + path: terraform-cloud + + - name: Push zip to bucket + run: | + mv function/functions.zip terraform-cloud/3-functions && cd terraform-cloud/3-functions && bash main.sh \ No newline at end of file diff --git a/.github/workflows/init-gcp.yml b/.github/workflows/init-gcp.yml new file mode 100644 index 0000000..1aa74d6 --- /dev/null +++ b/.github/workflows/init-gcp.yml @@ -0,0 +1,19 @@ +# .github/workflows/functions-gcp.yml +permissions: + contents: read + +on: + workflow_call: + + +jobs: + build: + name: Build + uses: ./.github/workflows/build-functions.yml + secrets: inherit + + gcp-terraform: + name: GCP + uses: ./.github/workflows/deploy-functions.yml + secrets: inherit + needs: [build] diff --git a/.github/workflows/node-build.yml b/.github/workflows/node-build.yml deleted file mode 100644 index ed5e8ff..0000000 --- a/.github/workflows/node-build.yml +++ /dev/null @@ -1,37 +0,0 @@ -# .github/workflows/node-build.yml -name: Build node project - - -on: - workflow_call: - inputs: - node-version: - required: true - type: string - -jobs: - build: - runs-on: ubuntu-latest - name: Node Build - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.node-version }} - - - name: Install dependencies - run: npm i - - - name: Build Project - run: npm run build - - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - name: web-build - path: dist - retention-days: 1 - \ No newline at end of file diff --git a/.github/workflows/node-init.yml b/.github/workflows/node-init.yml deleted file mode 100644 index 12100e7..0000000 --- a/.github/workflows/node-init.yml +++ /dev/null @@ -1,26 +0,0 @@ -# .github/workflows/node-build.yml -permissions: - contents: read - -on: - workflow_call: - inputs: - node-version: - required: true - type: string - -jobs: - node: - uses: ./.github/workflows/node-build.yml - with: - node-version: ${{ inputs.node-version }} - - azure-terraform: - name: Azure - uses: ./.github/workflows/azure-arquitecture.yml - secrets: inherit - - azure-deploy: - name: Azure - uses: ./.github/workflows/azure-web-app.yml - needs: [azure-terraform, node] diff --git a/LICENSE b/LICENSE index e8d0849..ccfcaf5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2026 Code Parce - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2026 Code Parce + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.