From a6cffbf5675d52f24496307a083e36b8f8fe97fe Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Fri, 31 Oct 2025 23:05:45 -0300 Subject: [PATCH] feat: fixes ci --- .github/workflows/docker-publish.yml | 45 ++++++++----------- .github/workflows/vercel-cleanup-pr.yml | 27 ----------- .../vercel-cleanup-previous-preview.yml | 33 -------------- angular.json | 12 ++--- 4 files changed, 24 insertions(+), 93 deletions(-) delete mode 100644 .github/workflows/vercel-cleanup-pr.yml delete mode 100644 .github/workflows/vercel-cleanup-previous-preview.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0d919c4..3aa48f4 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -2,8 +2,6 @@ name: ci on: push: - branches: - - "main" jobs: build: @@ -11,7 +9,7 @@ jobs: strategy: matrix: - node-version: [18.x] + node-version: [22.12.0] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -27,35 +25,28 @@ jobs: docker: needs: [build] runs-on: ubuntu-latest + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') + env: + IMAGE_TAG: ${{ github.ref_name == 'main' && 'latest' || 'dev' }} + IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/frontend-hideyoshi.com:latest + permissions: + contents: read + packages: write # required to push to ghcr.io + id-token: write # optional for OIDC if you use it steps: - name: Set up QEMU uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 + - name: Log in to GHCR + uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v2 - with: - platforms: linux/amd64,linux/arm64 - push: true - tags: yoshiunfriendly/frontend-hideyoshi.com:latest + - name: Build image + run: docker build -t $IMAGE_NAME . - run-dispatcher: - needs: docker - runs-on: ubuntu-latest - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Runs Infra-Hideyoshi.com Deployment Dispatcher - run: | - curl -X POST https://api.github.com/repos/HideyoshiSolutions/infra-hideyoshi.com/dispatches \ - -H 'Accept: application/vnd.github.everest-preview+json' \ - -u ${{ secrets.ACTIONS_KEY }} \ - --data '{"event_type": "refresh-deployments", "client_payload": { "deployments": "frontend-deployment" }}' + - name: Push image + run: docker push $IMAGE_NAME diff --git a/.github/workflows/vercel-cleanup-pr.yml b/.github/workflows/vercel-cleanup-pr.yml deleted file mode 100644 index 082202f..0000000 --- a/.github/workflows/vercel-cleanup-pr.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: vercel-cleanup-pr - -on: - pull_request: - types: [closed] - -env: - VERCEL_CLI_TOKEN: ${{ secrets.VERCEL_CLI_TOKEN }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - GITHUB_PR_ID: ${{ github.event.number }} - -jobs: - cleanup: - runs-on: ubuntu-latest - steps: - - name: Cleanup Vercel Deployments - run: | - closed_deployments=$(curl "https://api.vercel.com/v6/deployments?projectId=$VERCEL_PROJECT_ID" \ - -H "Accept: application/json" \ - -H "Authorization: Bearer ${VERCEL_CLI_TOKEN}" | jq -r ".deployments[] | select(.meta.githubPrId == \"${GITHUB_PR_ID}\") | .uid") - for deployment in $closed_deployments; do - echo "Deleting Deployment: $deployment" - curl "https://api.vercel.com/v6/now/deployments/$deployment" \ - -X DELETE \ - -H "Authorization: Bearer ${VERCEL_CLI_TOKEN}" - done - diff --git a/.github/workflows/vercel-cleanup-previous-preview.yml b/.github/workflows/vercel-cleanup-previous-preview.yml deleted file mode 100644 index 0906850..0000000 --- a/.github/workflows/vercel-cleanup-previous-preview.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: vercel-cleanup-preview - -on: - push: - branches: - - '*' - - '!main' - - '!devel' - -env: - VERCEL_CLI_TOKEN: ${{ secrets.VERCEL_CLI_TOKEN }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - GIT_PREVIOS_COMMIT: ${{ github.event.before }} - - -jobs: - cleanup: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Cleanup Vercel Deployments - run: | - - invalid_deployments=$(curl "https://api.vercel.com/v6/deployments?projectId=$VERCEL_PROJECT_ID" \ - -H "Accept: application/json" \ - -H "Authorization: Bearer ${VERCEL_CLI_TOKEN}" | jq -r ".deployments[] | select(.meta.githubCommitSha == \"${GIT_PREVIOS_COMMIT}\") | .uid") - - for deployment in $invalid_deployments; do - echo "Deleting Deployment: $deployment" - curl "https://api.vercel.com/v6/now/deployments/$deployment" \ - -X DELETE \ - -H "Authorization: Bearer ${VERCEL_CLI_TOKEN}" - done diff --git a/angular.json b/angular.json index 9351d47..8d1e8b1 100644 --- a/angular.json +++ b/angular.json @@ -50,13 +50,13 @@ "budgets": [ { "type": "initial", - "maximumWarning": "1mb", - "maximumError": "1.5mb" + "maximumWarning": "2.5mb", + "maximumError": "5mb" }, { "type": "anyComponentStyle", - "maximumWarning": "2.5kb", - "maximumError": "5kb" + "maximumWarning": "5kb", + "maximumError": "10kb" } ], "fileReplacements": [ @@ -66,7 +66,7 @@ } ], "outputHashing": "all", - "serviceWorker": true + "serviceWorker": "ngsw-config.json" }, "development": { "optimization": false, @@ -96,7 +96,7 @@ } }, "test": { - "builder": "@angular/build:karma", + "builder": "@angular/build:application", "options": { "main": "src/test.ts", "polyfills": "src/polyfills.ts",